ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting checkbox numbers (https://www.excelbanter.com/excel-programming/361541-selecting-checkbox-numbers.html)

Paula

selecting checkbox numbers
 
I have 12 checkboxes in each sheet, one for each month. They are labeled
Checkbox1 thru Checkbox12. Depending on the month, I want the macro to
select the proper checkbox number, for example, for March the checkbox it
should be looking for is Checkbox3. I have variables set for the month,
etc., but can't seem to figure out how to tell it to be a certain checkbox
based on that month in my main macro. I'd prefer to avoid doing a case
statement if I can, but will if that's the only way. Any assistance would
be appreciated.
--
Thanks - Paula

Jim Cone

selecting checkbox numbers
 
Sub GetThisMonthsCheckbox()
Dim N As Long
N = Month(Date)
Range(ActiveSheet.Shapes("Check Box " & N).ControlFormat.LinkedCell).Value = True
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Paula"

wrote in message
I have 12 checkboxes in each sheet, one for each month. They are labeled
Checkbox1 thru Checkbox12. Depending on the month, I want the macro to
select the proper checkbox number, for example, for March the checkbox it
should be looking for is Checkbox3. I have variables set for the month,
etc., but can't seem to figure out how to tell it to be a certain checkbox
based on that month in my main macro. I'd prefer to avoid doing a case
statement if I can, but will if that's the only way. Any assistance would
be appreciated.
--
Thanks - Paula


All times are GMT +1. The time now is 07:06 AM.

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