For the last 30 minutes, I have been trying to execute a line in VBA as a command. The command is like this, and it works fine:
activesheet.chb_g_ba1.visible = true
What I'm trying to do is set chb_g_ba1 as a variable, because there is also chb_g_ba2, chb_g_ba3, etc.
What I have tried so far are things like:
dim l_counter as long: l_counter = 1
Evaluate (CStr("me.chb_g_ba" & l_counter & ".visible = true"))
Or even Eval
Eval (CStr("me.chb_g_ba" & l_counter & ".visible = true"))
Eval is a function in MS Access VBA, but obviously it is not in Excel. To a large extent, my question is very similar to this one: VBA, how to run a line as a line of code , but this is for Excel, not Access.
So any ideas are welcome! :)
source
share