-
How to get the value of a checkbox when...
you have to first calculate the name of the checkbox.
Hello Everyone
My checkbox is reference via
sheets("Cover Page").checkboxN.value (where N is a number starting at 1..)
Challenge is checkboxN needs to be determined - i.e. it could be Checkbox2, Checkbox3, Checkbox4 etc which I have done.
However
I have constructed a string (I tried variant too) containing the reference and tried passing this to the EVALUATE function but no matter how I construct the string, trim it etc EVALUATE always returns TYPE MISMATCH
Strangley if I type EVALUATE(Sheets("Cover Page").Checkbox1.value) in the immediate window I get a true/false response.
Any ideas? Am I making sense!
Thank you everyone
-
Some code in case this inspires someone...thanks!
sNumber="1"
strString="sheets(""Cover Page"").chkAddon" & sNumber & ".value")
Evaluate(strString) 'This produces a type mismatch trying to workout the value of chkAddon1
Regards
-
I am not sure why you need Evaluate.
[VBA] MsgBox Worksheets("Sheet1").OLEObjects("chkAddon" & "1").Name, vbInformation, _
Worksheets("Sheet1").OLEObjects("chkAddon" & "1").Object.Value[/VBA]
-
Thanks Ken. Works fine.
No reason to use Evaluate - my assumption this was the approach to use.
Thankyou very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules