Thread: Userform/Module
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default 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