Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below works okay, but it takes four inputboxes to get the info.
I tried to use a single InputBox for the four inputs and use Split to assign those values to the variables for the checkboxes. So the inputbox window would look like: 5,H,4,MyCkBox Want 5 checkboxes In column H Starting at row 4 Named "MyCkBox" (no quotes, followed by a number) Split (InputBox string, ",")... etc. Thanks, Howard Sub Add_Checkboxes() Dim cBx, aNum As Long, aRow As Long Dim chkbx As CheckBox Dim CLeft, CTop, CHeight, CWidth As Double Dim aCol As String, MyNme As String aNum = Application.InputBox(Prompt:="Enter the number of Check boxes you want:", Title:="My Check Boxes", Type:=1) aCol = Application.InputBox(Prompt:="Enter the column letter of choice.", Title:="Check Box Column", Type:=2) aRow = Application.InputBox(Prompt:="Enter the row number ." & vbCr & _ "for the first check box.", Title:="First Check Box Row", Type:=1) MyNme = Application.InputBox(Prompt:="Enter the Caption (Name of Check Box).", Title:="My Name is...?", Type:=2) Application.ScreenUpdating = False For cBx = 1 To aNum CLeft = Cells(aRow, aCol).Left CTop = Cells(aRow, aCol).Top CHeight = Cells(aRow, aCol).Height CWidth = Cells(aRow, aCol).Width ActiveSheet.CheckBoxes.Add(CLeft, CTop, CWidth, CHeight).Select With Selection .Caption = MyNme & " " & cBx .Value = xlOff .Display3DShading = False End With aRow = aRow + 2 ' for every other row else aRow + 1 Next cBx Application.ScreenUpdating = True ActiveCell.Offset(1, 0).Activate End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Split Function | Excel Programming | |||
Split function | Excel Programming | |||
VBA SPLIT FUNCTION | Excel Programming | |||
Split Function | Excel Programming |