ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing Checkbox Name (https://www.excelbanter.com/excel-programming/414619-referencing-checkbox-name.html)

chad

Referencing Checkbox Name
 
I was wondering how I could reference the name of a checkbox and assign it to
the value of a cell.

To give an example of what I am looking for:

I have 5 checkboxes on a sheet and the names of these checkboxes will
eventually change. I would like call A1 to return the name of check box 1,
cell A2 to return the name of check box 2, and so on.

Any help would be greatly appreciated.

Thanks!

Chad

Office_Novice

Referencing Checkbox Name
 
Try this...

Sub Do_Cool_Stuff()
Dim CheckBoxes
CheckBoxes = Array(CheckBox1.Name, CheckBox2.Name, _
CheckBox3.Name, CheckBox4.Name, CheckBox5.Name)

Range("A1").Value = CheckBoxes(0)
Range("A2").Value = CheckBoxes(1)
Range("A3").Value = CheckBoxes(2)
Range("A4").Value = CheckBoxes(3)
Range("A5").Value = CheckBoxes(4)

End Sub


"Chad" wrote:

I was wondering how I could reference the name of a checkbox and assign it to
the value of a cell.

To give an example of what I am looking for:

I have 5 checkboxes on a sheet and the names of these checkboxes will
eventually change. I would like call A1 to return the name of check box 1,
cell A2 to return the name of check box 2, and so on.

Any help would be greatly appreciated.

Thanks!

Chad



All times are GMT +1. The time now is 01:58 PM.

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