質問編集履歴

3

修正

2020/05/19 02:13

投稿

koko2
koko2

スコア21

test CHANGED
File without changes
test CHANGED
@@ -72,6 +72,8 @@
72
72
 
73
73
  Dim keyWord As String
74
74
 
75
+  keyWord = Control1.Caption & "_" & Control2.Caption & "_" & Control3.Caption
76
+
75
77
 
76
78
 
77
79
  For Each Control1 In Frame1.Controls

2

誤記

2020/05/19 02:13

投稿

koko2
koko2

スコア21

test CHANGED
File without changes
test CHANGED
@@ -60,7 +60,9 @@
60
60
 
61
61
  <修正しました>
62
62
 
63
+ ```
64
+
63
- ```Private Sub CommandButton1_Click()
65
+ Private Sub CommandButton1_Click()
64
66
 
65
67
  Dim Control1 As Control
66
68
 

1

追記しました。

2020/05/19 02:01

投稿

koko2
koko2

スコア21

test CHANGED
File without changes
test CHANGED
@@ -55,3 +55,71 @@
55
55
 
56
56
 
57
57
  2.コマンドボタン2を押したら、ユーザーフォームのボタンの値を一度にクリア(初期状態)にする方法を教えてください。
58
+
59
+
60
+
61
+ <修正しました>
62
+
63
+ ```Private Sub CommandButton1_Click()
64
+
65
+ Dim Control1 As Control
66
+
67
+ Dim Control2 As Control
68
+
69
+ Dim Control3 As Control
70
+
71
+ Dim keyWord As String
72
+
73
+
74
+
75
+ For Each Control1 In Frame1.Controls
76
+
77
+ If Control1.Value = True Then Exit For
78
+
79
+ Next
80
+
81
+ For Each Control2 In Frame2.Controls
82
+
83
+ If Control2.Value = True Then Exit For
84
+
85
+ Next
86
+
87
+ For Each Control3 In Frame3.Controls
88
+
89
+ If Control3.Value = True Then
90
+
91
+ MsgBox Control1.Caption & "_" & Control2.Caption & "_" & Control3.Caption
92
+
93
+ Exit For
94
+
95
+ End If
96
+
97
+ Next
98
+
99
+
100
+
101
+ With Sheets("Sheet1").Range("A1")
102
+
103
+ .AutoFilter field:=1, Criteria1:=keyWord
104
+
105
+ .CurrentRegion.Offset(1, 0).Resize(.CurrentRegion.Rows.Count - 1, 4).Copy
106
+
107
+ End With
108
+
109
+
110
+
111
+ 'Sheet2の2列目の最後の行の下に貼付
112
+
113
+ With Sheets("Sheet2").Range("A1").CurrentRegion
114
+
115
+ .Cells(.Rows.Count + 1, 1).PasteSpecial
116
+
117
+ End With
118
+
119
+
120
+
121
+ End Sub
122
+
123
+ コード
124
+
125
+ ```