回答編集履歴
2
修正
test
CHANGED
@@ -16,7 +16,15 @@
|
|
16
16
|
|
17
17
|
w.Rows(1).Copy k.Rows(7)
|
18
18
|
|
19
|
+
Dim f As Range, t As Range
|
20
|
+
|
21
|
+
Set f = w.UsedRange.Resize(w.UsedRange.Rows.Count - 1).Offset(1)
|
22
|
+
|
19
|
-
|
23
|
+
Set t = k.Range("A" & k.Rows.Count).End(xlUp).Offset(1)
|
24
|
+
|
25
|
+
Debug.Print f.Address(, , , True), t.Address(, , , True)
|
26
|
+
|
27
|
+
f.Copy t
|
20
28
|
|
21
29
|
End If
|
22
30
|
|
@@ -24,6 +32,4 @@
|
|
24
32
|
|
25
33
|
End Sub
|
26
34
|
|
27
|
-
|
28
|
-
|
29
35
|
```
|
1
追記
test
CHANGED
@@ -1 +1,29 @@
|
|
1
1
|
見出しだけ先にコピーしておいて、Sheet1~Sheet3のデータを2行目からコピーする感じでどうですか?
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```VBA
|
6
|
+
|
7
|
+
Sub test()
|
8
|
+
|
9
|
+
Dim k As Worksheet, w As Worksheet
|
10
|
+
|
11
|
+
Set k = Worksheets("結合シート")
|
12
|
+
|
13
|
+
For Each w In Worksheets
|
14
|
+
|
15
|
+
If w.Name <> k.Name Then
|
16
|
+
|
17
|
+
w.Rows(1).Copy k.Rows(7)
|
18
|
+
|
19
|
+
w.UsedRange.Resize(w.UsedRange.Rows.Count - 1).Offset(1).Copy k.Range("A" & k.Rows.Count).End(xlUp).Offset(1)
|
20
|
+
|
21
|
+
End If
|
22
|
+
|
23
|
+
Next
|
24
|
+
|
25
|
+
End Sub
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```
|