Link to home
Create AccountLog in
Avatar of John Darby
John DarbyFlag for United States of America

asked on

Excel Form Control to Run UserSub

I have some beautiful code written by Martin Liss which executes formatting rules against a spreadsheet. I created a FormControl and have been attempting to Record a Macro where I click the RunSub/UserForm in the VBA Editor window. Apparently the action is not recordable. Could someone point me toward the code to pass to allow this "button" to perform the RunSub action?

Thank you!
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of John Darby



I have this:

Sub RunSub()
Call ColorByIndentLevel
End Sub

When it says Sub or Function not defined and higlights the first line, how do I define it? :)
Please post your workbook.

I just referenced the Sub you created for me directly and bingo the button work like a charm! Thank you!
In your command button's Click event put just Call ColorByIndentLevel If that sub is in a module it should work.
Once again, you're welcome.