LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default CheckBoxes and the Split function

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Split Function coco Excel Programming 2 June 16th 05 11:41 PM
Split function coco Excel Programming 2 June 16th 05 11:10 PM
VBA SPLIT FUNCTION PCC Excel Programming 9 April 17th 04 02:40 AM
Split Function TAM Excel Programming 1 February 21st 04 10:23 AM


All times are GMT +1. The time now is 09:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"