Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Strings from UserForm to Module John Kauffman Excel Programming 3 May 28th 04 05:01 PM
Textbox in Userform not recognised by Module SuperJas Excel Programming 5 February 26th 04 07:11 PM
Passing variables from module to userform Chris Dunigan Excel Programming 4 November 26th 03 09:37 AM
Userform with template class module problem Tom Ogilvy Excel Programming 0 July 17th 03 06:38 PM
Delete userform/module using VB Rohit Thomas Excel Programming 5 July 16th 03 11:01 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"