Hi all. I'm hoping there is an easy solution to this. Perhaps something I'm just overlooking.
I have a userform with a multipage control. Some of the pages on the multipage are very similar and require some formatting of other controls on the same page to work in the same way.
For example:
On page1 when Pg1optionbutton1 is true I need certain controls on the same page to become disabled.
But if Pg1optionbutton2 is true (forcing Pg1optionbutton1 to false) then I need those controls to be enabled again.
This process repeats for several of the pages and the code to enable/disable all these controls is quite hefty (there are more scenarios than just this one per page) and to make matters more complicated there are also more than one of these userforms, so I was hoping I could have a sub in a module that would perform all these changes but using variables for userform name and control name.
Below is code I'm attempting (very much simplified):
FormName and CtrlName are defined as Public strings in a standard module.
On userform1:
Then in a standard module I have:![]()
Please Login or Register to view this content.
However, when I select Pg1OptionButton1 it calls the right sub but fails on the line provided above with a Runtime Error 13 - Type Mismatch.![]()
Please Login or Register to view this content.
Any help on this would be greatly appreciated. Been banging my head on this one for far too many hours now!
Many thanks.
B.
PS. I know a sample workbook would be very helpful but this is part of a much bigger project and pulling it to bits would be almost impossible.
Bookmarks