I have a very simple macro as below to run a UserForm (formHygiene) in VBA. It works fine in one file.
I wanted to use it for other Excel file and copied the macro and the UserForm to other (by dragging them into a new VBA Project in VBA). Then when I ran the macro in the new Excel, I am getting a "Run-time error 9: Subscript out of range". When I tried to debug, it points to the line "formHygiene.Show" in the macro. So I think the error can be due to the new file not seeing the UserForm (formHygiene) somehow. But the UserForm is shown for the new one, as you see in the screenshot below. Can anyone tell me why I am getting this error?