Create Forms-Check Box down column?

l2l

New Member
Joined
Sep 18, 2005
Messages
10
Is there a way to have a macro create check boxes down column B stopping when there is no data in Column A?

thank you. l2l
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try this:

Code:
Sub Test()

Dim Row As Integer

Application.ScreenUpdating = False

Row = 1

While Cells(Row, 1) <> ""
    
        ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
        DisplayAsIcon:=False, Left:=Cells(Row, 2).Left, Top:=Cells(Row, 1).Top, Width:=15, Height:=15). _
        Select
        
    Row = Row + 1
        
Wend

Application.ScreenUpdating = True

End Sub
 
Upvote 0
Thanks for the reply. The macro looks like it can only be run once before it writes over check boxes placed there before. Any way to modify this?

Thanks,
L2L
 
Upvote 0
Assuming you only have check boxes in your sheet I think this works:

Code:
Sub OnlyAddIfBlank()

Dim Row As Integer
Dim NbrOfTickBoxes As Integer

Application.ScreenUpdating = False

NbrOfTickBoxes = ActiveSheet.OLEObjects.Count
StartRow = NbrOfTickBoxes + 1
Row = StartRow

While Cells(Row, 1) <> ""
        
    ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
    DisplayAsIcon:=False, Left:=Cells(Row, 2).Left, Top:=Cells(Row, 1).Top, Width:=15, Height:=15).Select
    
    Row = Row + 1
    
Wend

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top