回答編集履歴
3
コード追記
test
CHANGED
@@ -38,9 +38,35 @@
|
|
38
38
|
|
39
39
|
```
|
40
40
|
|
41
|
+
**別案1**
|
42
|
+
|
43
|
+
配列に連続値を入力しておいて、セル範囲に代入
|
44
|
+
|
45
|
+
```vba
|
46
|
+
|
47
|
+
Dim v(), i As Long, cnt As Long
|
48
|
+
|
49
|
+
ReDim v(12 To EROW, 1 To 1)
|
50
|
+
|
51
|
+
cnt = Cells(11, 1).Value
|
52
|
+
|
53
|
+
For i = 12 To EROW
|
54
|
+
|
55
|
+
cnt = cnt + 1
|
56
|
+
|
57
|
+
v(i, 1) = cnt
|
58
|
+
|
59
|
+
Next
|
60
|
+
|
61
|
+
Range(Cells(12, 1), Cells(EROW, 1)).Value = v
|
62
|
+
|
63
|
+
```
|
41
64
|
|
42
65
|
|
66
|
+
|
67
|
+
|
68
|
+
|
43
|
-
**別案**
|
69
|
+
**別案2**
|
44
70
|
|
45
71
|
加算する式を設定して、値に変換。
|
46
72
|
|
2
コード追記
test
CHANGED
@@ -37,3 +37,21 @@
|
|
37
37
|
End With
|
38
38
|
|
39
39
|
```
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
**別案**
|
44
|
+
|
45
|
+
加算する式を設定して、値に変換。
|
46
|
+
|
47
|
+
```vba
|
48
|
+
|
49
|
+
With Range(Cells(12, 1), Cells(EROW, 1))
|
50
|
+
|
51
|
+
.Formula = "=A11+1"
|
52
|
+
|
53
|
+
.Value = .Value
|
54
|
+
|
55
|
+
End With
|
56
|
+
|
57
|
+
```
|
1
コード追記
test
CHANGED
@@ -4,10 +4,36 @@
|
|
4
4
|
|
5
5
|
```vba
|
6
6
|
|
7
|
-
Cells(1, 1).AutoFill Destination:=Range(Cells(1, 1), Cells(EROW, 1)), Type:=xlLinearTrend
|
7
|
+
Cells(11, 1).AutoFill Destination:=Range(Cells(11, 1), Cells(EROW, 1)), Type:=xlLinearTrend
|
8
8
|
|
9
|
-
Range(Cells(2, 1), Cells(EROW, 1)).Interior.ColorIndex = 0 '背景色をクリア
|
9
|
+
Range(Cells(12, 1), Cells(EROW, 1)).Interior.ColorIndex = 0 '背景色をクリア
|
10
10
|
|
11
|
-
'Range(Cells(2, 1), Cells(EROW, 1)).ClearFormats 'すべての書式をクリアする場合はこちら
|
11
|
+
'Range(Cells(12, 1), Cells(EROW, 1)).ClearFormats 'すべての書式をクリアする場合はこちら
|
12
12
|
|
13
13
|
```
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
追記
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
AutoFill後に右の列を書式をコピーする
|
24
|
+
|
25
|
+
```vba
|
26
|
+
|
27
|
+
Cells(11, 1).AutoFill Destination:=Range(Cells(11, 1), Cells(EROW, 1)), Type:=xlLinearTrend
|
28
|
+
|
29
|
+
With Range(Cells(12, 1), Cells(EROW, 1))
|
30
|
+
|
31
|
+
.Offset(0, 1).Copy
|
32
|
+
|
33
|
+
.PasteSpecial Paste:=xlPasteFormats
|
34
|
+
|
35
|
+
Application.CutCopyMode = False
|
36
|
+
|
37
|
+
End With
|
38
|
+
|
39
|
+
```
|