I'm having trouble figuring out how to reference the name of an option button that I'm storing in a string variable so I can check all the option buttons on my sheet with an IF statement in a loop. I'm populating variable 'strOptionName' from an array at the beginning of each loop iteration and performing the following IF statement where "pre01y" is the name of the option button:
The above runs fine and if the "pre01y" option button is selected (true) then the code drops into my IF statement. However, if I am populating a variable name such as "strOptionName" with the same value (option name) it does not work like this:
I get an Object doesn't support property or method error using the option button name in a variable. I have tried doing concatenation, brackets, etc. without any luck. Is it possible to do this and if so how?