LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Call a UserForm based on ComboBox selection

Try something like

Select Case UCase(Selection.Text)
Case "A"
Userform1.Show
Case "B"
Userform2.Show
' and so on
End Select

If you want to get a bit trickier, you can use code like

Sub AAA()
Dim N As Long
Dim Obj As Object
N = 3
Select Case N
Case 1
Set Obj = VBA.UserForms.Add("Userform1")
Case 2
Set Obj = VBA.UserForms.Add("Userform2")
Case 3
Set Obj = VBA.UserForms.Add("Userform3")
End Select
If Not Obj Is Nothing Then
Obj.Show
End If
End Sub

See http://www.cpearson.com/Excel/showanyform.htm for an explanation.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)






"DJ" wrote in message
...
Ive created a worksheet ComboBox that contains options A, B, and C. When
option C is selected, I would like UserForm1 to appear. I am having
trouble
calling the user form. I have tried variations of the following:

Private Sub Options_Click()
'If TypeName(Selection) = "C" Then Load UserForm1
End Sub

Any help is much appreciated!
DJ


 
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
Populate Sheet based on ComboBox selection Steve[_4_] Excel Programming 4 March 5th 08 02:11 AM
How to populate a combobox based on selection from another combobo LinnT Excel Programming 6 November 23rd 07 09:23 AM
VB Script based on combobox selection gmac[_2_] Excel Programming 1 March 30th 07 07:34 PM
Userform: Textbox changing with selection in combobox (list) NorTor[_3_] Excel Programming 3 June 8th 04 10:19 PM
Excel - Copy range of cells based on Combobox Selection Excel-erate2004 Excel Programming 2 April 3rd 04 05:35 PM


All times are GMT +1. The time now is 09:52 AM.

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"