If Selection.Count > 999999 Then '不接受低於二筆資料處理
MsgBox ("資料表輸入資料太少,請確認。")
Exit Sub
End If
'2013/07/31 Test
Range("A3").Select
Range("A3", Selection.End(xlToRight)).Select
ListCount = Selection.Columns.Count
ComboBox1.Clear
ReDim listname(ListCount - 1) As String
For i = 0 To ListCount - 1
If i <= 25 Then
listname(i) = Range(Chr(65 + i) & "3").Text
Else
listname(i) = Range("A" & Chr(65 + i - 25) & "3").Text
End If
ComboBox1.AddItem listname(i)
Next i
'新增checkbox
For i = 0 To ListCount - 1
OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=0 + 93.5 * i, Top:=126, Width:=90, Height:=22.5).Select
Next i
'checkbox改名
ReDim listname1(ListCount) As String
For i = 1 To ListCount
If i <= 25 Then
listname1(i) = Range(Chr(64 + i) & "3").Text
Else
listname1(i) = Range("A" & Chr(64 + i - 25) & "3").Text
End If
Next i
For i = 1 To ListCount
Sheets("資料").OLEObjects("CheckBox" & i).Object.Caption = listname1(i)
Next i作者: rick4615 時間: 2013-8-9 16:09