1:在第一個單元格插入複選框後拖動複製。
2:如果單元格區域不規則可以用下面程式碼:
Private Sub AddCheckBoxesInRange()
On Error Resume Next
Dim cell As Range
Dim CurrentRange As Range
Set CurrentRange = Selection
CurrentRange.NumberFormatLocal = ";;;"
Application.ScreenUpdating = False
For Each cell In CurrentRange
ActiveSheet.CheckBoxes.Add(cell.Left, cell.Top, cell.Height, cell.Height).Select
With Selection
.Value = xlOff
.LinkedCell = cell.Address
.Display3DShading = False
.Characters.Text = ""
End With
Next
CurrentRange.Select
Application.ScreenUpdating = True
Set cell = Nothing
End Sub
1:在第一個單元格插入複選框後拖動複製。
2:如果單元格區域不規則可以用下面程式碼:
Private Sub AddCheckBoxesInRange()
On Error Resume Next
Dim cell As Range
Dim CurrentRange As Range
Set CurrentRange = Selection
CurrentRange.NumberFormatLocal = ";;;"
Application.ScreenUpdating = False
For Each cell In CurrentRange
ActiveSheet.CheckBoxes.Add(cell.Left, cell.Top, cell.Height, cell.Height).Select
With Selection
.Value = xlOff
.LinkedCell = cell.Address
.Display3DShading = False
.Characters.Text = ""
End With
Next
CurrentRange.Select
Application.ScreenUpdating = True
Set cell = Nothing
End Sub