![]() |
Userform/Module
Hi All, I have to dif. VBA short programs for calculating wt. conversion temp. conversion. As of now I have two different files to run thes programs. What I am trying to do is to use one user from with optio buttons to choose a program to run. how can I write the code to choos a specifice module when a button is sellected? Appreciate your help. Thanks Sye -- sazi ----------------------------------------------------------------------- saziz's Profile: http://www.excelforum.com/member.php...nfo&userid=635 View this thread: http://www.excelforum.com/showthread.php?threadid=47563 |
Userform/Module
Copy both of your macros into module sheet/s in the same workbook, I
have called them macro1 and macro2. Create your userform with two optionbuttons and a commandbutton. The code in the userform would then look something like this: Private Sub UserForm_Initialize() Me.OptionButton1 = True End Sub Private Sub CommandButton1_Click() If Me.OptionButton1 Then Call macro1 Else Call macro2 End If Unload.Me End Sub Hope this helps Rowan saziz wrote: Hi All, I have to dif. VBA short programs for calculating wt. conversion & temp. conversion. As of now I have two different files to run these programs. What I am trying to do is to use one user from with option buttons to choose a program to run. how can I write the code to choose a specifice module when a button is sellected? Appreciate your help. Thanks Syed |
Userform/Module
Hi Rowan, Thanks for your reply. I am trying to show userform1 or userform2, if a specific button is clicked. As you wrote to call macro how do I get to trigger module to show that specific userform? I hope I am clear enough. Thanks Syed -- saziz ------------------------------------------------------------------------ saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350 View this thread: http://www.excelforum.com/showthread...hreadid=475633 |
Userform/Module
The code to load a userform is:
UserForm1.Show so if you are wanting this to run when a button (say commandbutton1) is clicked then maybe: Private Sub CommandButton1_Click() If Me.OptionButton1 Then userform1.show Else userform2.show End If Unload.Me End Sub Hope this helps Rowan saziz wrote: Hi Rowan, Thanks for your reply. I am trying to show userform1 or userform2, if a specific button is clicked. As you wrote to call macro how do I get to trigger module to show that specific userform? I hope I am clear enough. Thanks Syed |
All times are GMT +1. The time now is 01:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com