1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Dim myCell As Range
Dim numCell As Integer
Dim myGroupBox As GroupBox
Dim myOptionButton As OptionButton
ActiveSheet.OptionButtons.Delete
ActiveSheet.GroupBoxes.Delete
numCell = 0
For Each myCell In ActiveSheet.Range("E2:E12").Cells
If numCell = 0 Then
Set myGroupBox = ActiveSheet.GroupBoxes.Add(myCell.Left, myCell.Top, myCell.Width, myCell.Height * 3)
myGroupBox.Caption = ""
End If
numCell = numCell + 1
If numCell = 3 Then numCell = 0
Next
For Each myCell In ActiveSheet.Range("E2:E13").Cells
Set myOptionButton = ActiveSheet.OptionButtons.Add(myCell.Left, myCell.Top, myCell.Width, myCell.Height)
myOptionButton.Caption = "Option Button"
Next |
Partager