ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Commandbutton in UserForm to run Macro (https://www.excelbanter.com/excel-programming/291504-commandbutton-userform-run-macro.html)

salihyil[_4_]

Commandbutton in UserForm to run Macro
 
i have created 2 commandbutton in UserForm. i also created 2 macros bu
i dont know how to link the commandbuttons in userform to macro.

seeking for help!!!

thanx:rolleyes: :rolleyes

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Commandbutton in UserForm to run Macro
 
in the VBE with the userform visible, double click on the first command
button.

You should see

Private Sub CommandButton1_Click()

End Sub

(it will have the name you assigned you commandbutton)

Put a call to your macro there
Private Sub CommandButton1_Click()
mymacro1
End Sub

In the left dropdown at the top of the module, select the other
commandbutton. In the left dropdown, select click. You should get a
similar declaration and you can call your second macro from there.

--
Regards,
Tom Ogilvy


"salihyil " wrote in message
...
i have created 2 commandbutton in UserForm. i also created 2 macros but
i dont know how to link the commandbuttons in userform to macro.

seeking for help!!!

thanx:rolleyes: :rolleyes:


---
Message posted from http://www.ExcelForum.com/




salihyil[_5_]

Commandbutton in UserForm to run Macro
 
thanks Tom Ogilvy

i appriciate

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com