質問編集履歴
2
自分で試したことを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,6 +58,56 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
|
61
|
+
```Sub filter()
|
62
|
+
|
63
|
+
Dim i As Long
|
64
|
+
|
65
|
+
Dim ws, ws2 As Worksheet
|
66
|
+
|
67
|
+
Dim path As String
|
68
|
+
|
69
|
+
path = "E:\work\"
|
70
|
+
|
71
|
+
Set ws = Worksheets("sheet23")
|
72
|
+
|
73
|
+
Set ws2 = Worksheets.Add(after:=ws)
|
74
|
+
|
75
|
+
Dim c As Integer
|
76
|
+
|
77
|
+
c = 1
|
78
|
+
|
79
|
+
Dim result As Range
|
80
|
+
|
81
|
+
With ws.UsedRange
|
82
|
+
|
83
|
+
For i = 2 To .Rows.count
|
84
|
+
|
85
|
+
Set result = ws2.Columns(1).Find(what:=ws.Cells(i, 1))
|
86
|
+
|
87
|
+
If result Is Nothing Then
|
88
|
+
|
89
|
+
ws2.Cells(c, 1) = ws.Cells(i, 1)
|
90
|
+
|
91
|
+
.autoFilter 1, Cells(i, 1)
|
92
|
+
|
93
|
+
ws.ExportAsFixedFormat Type:=xlTypePDF, Filename:=path & ws.Cells(i, 1)
|
94
|
+
|
95
|
+
c = c + 1
|
96
|
+
|
97
|
+
End If
|
98
|
+
|
99
|
+
Next
|
100
|
+
|
101
|
+
End With
|
102
|
+
|
103
|
+
ws.AutoFilterMode = False
|
104
|
+
|
105
|
+
End Sub
|
106
|
+
|
107
|
+
コード
|
108
|
+
|
109
|
+
```
|
110
|
+
|
61
111
|
```![![イメージ説明](a1e113364b37ee0b51549a1c9d070c14.png)](7909b2da8fd1ac8bb88ae296004c19b0.png)
|
62
112
|
|
63
113
|
![イメージ説明](2012775f776b335d890db18e4d793949.png)
|
1
コードに不備がありましたので訂正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
'フィルター後の印刷や、メール送信の処理を書く
|
52
52
|
|
53
|
-
Cells(1, 1)
|
53
|
+
Cells(1, 1).autoFilter 'フィルター解除
|
54
54
|
|
55
55
|
Next i
|
56
56
|
|