ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to use a variable in this line (https://www.excelbanter.com/excel-programming/445829-how-use-variable-line.html)

Jesper F

how to use a variable in this line
 
This works
If Sheets("refdata").chkAll = True Then

but I want to cycle through many checkboxes.
How do I use a varialble for the checkboxname?

These dont work:
Sheets("refdata")(myvar)
Sheets("refdata").(myvar)
Sheets("refdata")(" & myvar & ")
Sheets("refdata").(" & myvar & ")

isabelle

how to use a variable in this line
 
hi Jesper,

With Sheets("refdata")
For Each Sh In .Shapes
If TypeName(Sh.OLEFormat.Object.Object) = "CheckBox" Then
If Sh.OLEFormat.Object.Object.Value = True Then
MsgBox Sh.Name
End If
End If
Next
End With



--
isabelle



Le 2012-04-19 12:15, Jesper F a écrit :
This works
If Sheets("refdata").chkAll = True Then

but I want to cycle through many checkboxes.
How do I use a varialble for the checkboxname?

These dont work:
Sheets("refdata")(myvar)
Sheets("refdata").(myvar)
Sheets("refdata")("& myvar& ")
Sheets("refdata").("& myvar& ")



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

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