回答編集履歴
4
修正
test
CHANGED
@@ -258,7 +258,7 @@
|
|
258
258
|
|
259
259
|
|
260
260
|
|
261
|
-
Frame3と、その下に-OptionButton8から
|
261
|
+
Frame3と、その下に-OptionButton8から14つながっていますでしょうか?
|
262
262
|
|
263
263
|
|
264
264
|
|
3
追記
test
CHANGED
@@ -247,3 +247,59 @@
|
|
247
247
|
End Sub
|
248
248
|
|
249
249
|
```
|
250
|
+
|
251
|
+
追記2
|
252
|
+
|
253
|
+
下記コードでフレームとオプションボタンの位置関係わかります。
|
254
|
+
|
255
|
+
フレーム名とその中にあるオプションボタンが
|
256
|
+
|
257
|
+
Frame3-OptionButton8のように表示されます。
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
Frame3と、その下に-OptionButton8から9つながっていますでしょうか?
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
![イメージ説明](480803e273a3be238a45ccc64c5b369f.png)
|
266
|
+
|
267
|
+
```VBA
|
268
|
+
|
269
|
+
Sub test01()
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
Dim MyCtrl As Object
|
274
|
+
|
275
|
+
Dim InCtrl As Object
|
276
|
+
|
277
|
+
Dim MyStr As String
|
278
|
+
|
279
|
+
With UserForm1
|
280
|
+
|
281
|
+
For Each MyCtrl In .Controls
|
282
|
+
|
283
|
+
If InStr(MyCtrl.Name, "Frame") > 0 Then
|
284
|
+
|
285
|
+
For Each InCtrl In MyCtrl.Controls
|
286
|
+
|
287
|
+
MyStr = MyStr & MyCtrl.Name & "-" & InCtrl.Name & vbCrLf
|
288
|
+
|
289
|
+
Next
|
290
|
+
|
291
|
+
End If
|
292
|
+
|
293
|
+
MyStr = MyStr & MyCtrl.Name & vbCrLf
|
294
|
+
|
295
|
+
Next
|
296
|
+
|
297
|
+
MsgBox MyStr
|
298
|
+
|
299
|
+
End With
|
300
|
+
|
301
|
+
End Sub
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
```
|
2
修正追記
test
CHANGED
@@ -2,7 +2,19 @@
|
|
2
2
|
|
3
3
|
各列のフィルター値取得セットできると思います
|
4
4
|
|
5
|
-
![イメージ説明](
|
5
|
+
![イメージ説明](acc1c501aa0c66a78971d813aa05f6ff.png)
|
6
|
+
|
7
|
+
フレームを配置し、各フレーム内に必要個数のOptionButtonを配置しています。
|
8
|
+
|
9
|
+
Frame1 上から OptionButton1から4
|
10
|
+
|
11
|
+
Frame2 上から OptionButton5から7
|
12
|
+
|
13
|
+
Frame3 上から OptionButton8から14
|
14
|
+
|
15
|
+
です。
|
16
|
+
|
17
|
+
|
6
18
|
|
7
19
|
```VBA
|
8
20
|
|
@@ -12,6 +24,8 @@
|
|
12
24
|
|
13
25
|
Dim Control2 As Control
|
14
26
|
|
27
|
+
Dim Control3 As Control
|
28
|
+
|
15
29
|
|
16
30
|
|
17
31
|
For Each Control1 In Frame1.Controls
|
@@ -26,11 +40,17 @@
|
|
26
40
|
|
27
41
|
Next
|
28
42
|
|
29
|
-
|
43
|
+
For Each Control3 In Frame3.Controls
|
44
|
+
|
30
|
-
|
45
|
+
If Control3.Value = True Then
|
46
|
+
|
31
|
-
MsgBox Control1.Caption &
|
47
|
+
MsgBox Control1.Caption & "_" & Control2.Caption & "_" & Control3.Caption
|
48
|
+
|
32
|
-
|
49
|
+
Exit For
|
50
|
+
|
33
|
-
|
51
|
+
End If
|
52
|
+
|
53
|
+
Next
|
34
54
|
|
35
55
|
End Sub
|
36
56
|
|
1
追記
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
各列のフィルター値取得セットできると思います
|
4
4
|
|
5
|
-
![イメージ説明](
|
5
|
+
![イメージ説明](f9f2d3448cb291d81d82f4df5013d8eb.png)
|
6
6
|
|
7
7
|
```VBA
|
8
8
|
|
@@ -35,3 +35,195 @@
|
|
35
35
|
End Sub
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
追記、
|
40
|
+
|
41
|
+
```VBA
|
42
|
+
|
43
|
+
Private Sub OptionButton1_AfterUpdate()
|
44
|
+
|
45
|
+
Call Chk1
|
46
|
+
|
47
|
+
End Sub
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
Private Sub OptionButton2_AfterUpdate()
|
52
|
+
|
53
|
+
Call Chk1
|
54
|
+
|
55
|
+
End Sub
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
Private Sub OptionButton3_AfterUpdate()
|
60
|
+
|
61
|
+
Call Chk1
|
62
|
+
|
63
|
+
End Sub
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
Private Sub OptionButton4_AfterUpdate()
|
68
|
+
|
69
|
+
Call Chk1
|
70
|
+
|
71
|
+
End Sub
|
72
|
+
|
73
|
+
Sub Chk1()
|
74
|
+
|
75
|
+
Dim Control1 As Control
|
76
|
+
|
77
|
+
Dim Control2 As Control
|
78
|
+
|
79
|
+
Dim Chk As Boolean
|
80
|
+
|
81
|
+
Dim myRange As Range
|
82
|
+
|
83
|
+
Dim myObj As Range
|
84
|
+
|
85
|
+
Dim keyWord As String
|
86
|
+
|
87
|
+
Set myRange = Range("A:A")
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
For Each Control1 In Frame1.Controls
|
92
|
+
|
93
|
+
If Control1.Value = True Then
|
94
|
+
|
95
|
+
Chk = True
|
96
|
+
|
97
|
+
Exit For
|
98
|
+
|
99
|
+
End If
|
100
|
+
|
101
|
+
Next
|
102
|
+
|
103
|
+
If Chk = True Then
|
104
|
+
|
105
|
+
For Each Control2 In Frame2.Controls
|
106
|
+
|
107
|
+
keyWord = Control1.Caption & "_" & Control2.Caption & "_*"
|
108
|
+
|
109
|
+
Set myObj = myRange.Find(keyWord, LookAt:=xlWhole)
|
110
|
+
|
111
|
+
If myObj Is Nothing Then
|
112
|
+
|
113
|
+
Control2.Enabled = False
|
114
|
+
|
115
|
+
Control2.Value = False
|
116
|
+
|
117
|
+
Else
|
118
|
+
|
119
|
+
Control2.Enabled = True
|
120
|
+
|
121
|
+
Control2.Value = False
|
122
|
+
|
123
|
+
End If
|
124
|
+
|
125
|
+
Next
|
126
|
+
|
127
|
+
For Each Control3 In Frame3.Controls
|
128
|
+
|
129
|
+
Control3.Enabled = False
|
130
|
+
|
131
|
+
Control3.Value = False
|
132
|
+
|
133
|
+
Next
|
134
|
+
|
135
|
+
End If
|
136
|
+
|
137
|
+
End Sub
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
Private Sub OptionButton5_AfterUpdate()
|
142
|
+
|
143
|
+
Call Chk2
|
144
|
+
|
145
|
+
End Sub
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
Private Sub OptionButton6_AfterUpdate()
|
150
|
+
|
151
|
+
Call Chk2
|
152
|
+
|
153
|
+
End Sub
|
154
|
+
|
155
|
+
Private Sub OptionButton7_AfterUpdate()
|
156
|
+
|
157
|
+
Call Chk2
|
158
|
+
|
159
|
+
End Sub
|
160
|
+
|
161
|
+
Sub Chk2()
|
162
|
+
|
163
|
+
Dim Control1 As Control
|
164
|
+
|
165
|
+
Dim Control2 As Control
|
166
|
+
|
167
|
+
Dim Control3 As Control
|
168
|
+
|
169
|
+
Dim Chk As Boolean
|
170
|
+
|
171
|
+
Dim myRange As Range
|
172
|
+
|
173
|
+
Dim myObj As Range
|
174
|
+
|
175
|
+
Dim keyWord As String
|
176
|
+
|
177
|
+
Set myRange = Range("A:A")
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
For Each Control1 In Frame1.Controls
|
182
|
+
|
183
|
+
If Control1.Value = True Then Exit For
|
184
|
+
|
185
|
+
Next
|
186
|
+
|
187
|
+
For Each Control2 In Frame2.Controls
|
188
|
+
|
189
|
+
If Control2.Value = True Then
|
190
|
+
|
191
|
+
Chk = True
|
192
|
+
|
193
|
+
Exit For
|
194
|
+
|
195
|
+
End If
|
196
|
+
|
197
|
+
Next
|
198
|
+
|
199
|
+
If Chk = True Then
|
200
|
+
|
201
|
+
For Each Control3 In Frame3.Controls
|
202
|
+
|
203
|
+
keyWord = Control1.Caption & "_" & Control2.Caption & "_" & Control3.Caption
|
204
|
+
|
205
|
+
Debug.Print keyWord
|
206
|
+
|
207
|
+
Set myObj = myRange.Find(keyWord, LookAt:=xlWhole)
|
208
|
+
|
209
|
+
If myObj Is Nothing Then
|
210
|
+
|
211
|
+
Control3.Enabled = False
|
212
|
+
|
213
|
+
Control3.Value = False
|
214
|
+
|
215
|
+
Else
|
216
|
+
|
217
|
+
Control3.Enabled = True
|
218
|
+
|
219
|
+
Control3.Value = False
|
220
|
+
|
221
|
+
End If
|
222
|
+
|
223
|
+
Next
|
224
|
+
|
225
|
+
End If
|
226
|
+
|
227
|
+
End Sub
|
228
|
+
|
229
|
+
```
|