|
▼mickeypapa さん今晩は
>もっとすっきりとしたコードにならないものかと考えております。
でどうですか?
Sub test2()
Dim myRan As String
Dim i, myRow As Integer
'
Dim A As Variant
A = Array("M2:M", "N2:N", "O2:O", " Q2:Q", "R2:R", "S2:S", "T2:T", "U2:U", "V2:V", "W2:W")
'
With frmCBO
For i = 1 To 11
If .Controls("Opt" & i) = True Then Exit For
Next i
'
myRow = Sheets("CBO").Cells(65536, 12 + i).End(xlUp).Row
myRan = "CBO!" & A(i - 1) & myRow
'
With .ListBox1
.ColumnCount = 1 '列数の設定
.RowSource = myRan 'リスト
.ColumnWidths = "40 pt"
End With
End With
End Sub
|
|