回答編集履歴

2

書式改善

2021/06/09 01:49

投稿

hatena19
hatena19

スコア34075

test CHANGED
@@ -108,4 +108,4 @@
108
108
 
109
109
  End Sub
110
110
 
111
- ``
111
+ ```

1

コード追記

2021/06/09 01:48

投稿

hatena19
hatena19

スコア34075

test CHANGED
@@ -68,6 +68,44 @@
68
68
 
69
69
  End Sub
70
70
 
71
+ ```
71
72
 
72
73
 
74
+
75
+ おまけ
76
+
77
+ 配列とForループでシンプルにした例
78
+
79
+
80
+
81
+ ```vba
82
+
83
+ Public Sub test()
84
+
85
+ Dim WSs(1 To 3) As String
86
+
87
+
88
+
89
+ Dim ws As Worksheet, i As Long
90
+
91
+ For Each ws In Sheets
92
+
93
+ i = Left(ws.Name, 1)
94
+
95
+ WSs(i) = WSs(i) & " " & ws.Name
96
+
97
+ Next
98
+
99
+
100
+
101
+ For i = 1 To UBound(WSs)
102
+
103
+ Sheets(Split(Trim(WSs(i)))).Select
104
+
105
+ ActiveSheet.ExportAsFixedFormat Type:=0, Filename:="C:\test\" & i & "00.pdf"
106
+
107
+ Next
108
+
109
+ End Sub
110
+
73
- ```
111
+ ``