ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   checkboxes (https://www.excelbanter.com/excel-programming/285124-checkboxes.html)

marksuza[_3_]

checkboxes
 
Hi, I was wondering if you guys could help me with something. I have t
create a column with several checkboxes, all linked to a respectiv
cell. My idea is something like this:

count=1
cell=1

Do

create checkbox in 'A'cell
link checkbox to 'A'cell

count= count +1
cell = cell +1

while count < 1000

Can anyone help me with the syntax?

Thanks a lot

Mar

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

checkboxes
 
Sub Macro1()
' clear existing checkboxes
ActiveSheet.CheckBoxes.Delete
For Each cell In Range("A1:A1000")
With ActiveSheet.CheckBoxes.Add( _
cell.Left, cell.Top, cell.Width, cell.Height)
.LinkedCell = cell.Address(external:=True)
.Caption = ""
End With
Next
End Sub


Uses checkboxes from the forms toolbar.

--
Regards,
Tom Ogilvy

"marksuza" wrote in message
...
Hi, I was wondering if you guys could help me with something. I have to
create a column with several checkboxes, all linked to a respective
cell. My idea is something like this:

count=1
cell=1

Do

create checkbox in 'A'cell
link checkbox to 'A'cell

count= count +1
cell = cell +1

while count < 1000

Can anyone help me with the syntax?

Thanks a lot

Mark


---
Message posted from http://www.ExcelForum.com/




BrianB

checkboxes
 
This uses the Checkbox from the Forms toolbar. I don't recommend the one
on the Controls toolbar because it tends to be very buggy - especially
when using large numbers. Amend as necessary.

'---------------------------------------------
Sub MAKE_CHECKBOXES()
Dim CB As Integer
Dim CBox As Object
Dim CBcount As Long
Dim CBtop As Double
Dim CBlink As String
'------------------------------------------
CBcount = ActiveSheet.CheckBoxes.Count
For CB = CBcount + 1 To 10
CBtop = CB * 25
CBlink = "A" & CB
ActiveSheet.CheckBoxes.Add 50, CBtop, 60, 20
Set CBox = ActiveSheet.CheckBoxes(CB)
With CBox
Text = "MyBox" & CB
Value = xlOff
LinkedCell = CBlink
Interior.ColorIndex = 40
Border.LineStyle = msoLineSingle
Border.Weight = xlMedium
Display3DShading = True
End With
Next
End Sub
'--------------------------------------------


---
Message posted from http://www.ExcelForum.com/


marksuza[_4_]

checkboxes
 
Thanks for the help, really helpful.

Mark


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com