LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Userform Initialize & Command Button, Excel 2000 & 2003

On Feb 18, 6:38 pm, "Tom Ogilvy" wrote:
I would check the spelling between you array values and your if statements.

If you are going to call different procedures you could use the listindex
property.

select Case combobox1.listindex
Case -1
' do nothing
Case 0
UserFormFIND
Case 1
FindDialogBoxOpen
Case 2
GoToDialogBoxOpen

. . .
End Select

--
Regards,
Tom Ogilvy

"jfcby" wrote in message

oups.com...

Hello,


I have a userform with a combo box and a commandbutton. The combobox
uses the .additem, currently it has 11 items but will be added to. My
UserForm_Initialize is below:


Private Sub UserForm_Initialize()
Dim varData(10) As Variant
varData(0) = ""
varData(1) = "Search"
varData(2) = "Find"
varData(3) = "GoTo"
varData(4) = "Compare Data"
varData(5) = "Delete Characters"
varData(6) = "Number Cells 1-25"
varData(7) = "Number Sells Value 001"
varData(8) = "Find Blank Cell"
varData(9) = "Fill Selection Copy"
varData(10) = "Fill Selection Series"
With ComboBox1
.AddItem varData(0)
.AddItem varData(1)
.AddItem varData(2)
.AddItem varData(3)
.AddItem varData(4)
.AddItem varData(5)
.AddItem varData(6)
.AddItem varData(7)
.AddItem varData(8)
.AddItem varData(9)
.AddItem varData(10)
End With
End Sub


My commandbutton is below:


Private Sub CommandButton3_Click()
cb = ComboBox1
If cb = "" Then
'Do Nothing
ElseIf cb = "Search" Then
Call UserFormFIND
ElseIf cb = "Find" Then
Call FindDialogBoxOpen
ElseIf cb = "GoTo" Then
Call GoToDialogBoxOpen
ElseIf cb = "Compare Data" Then
Call CompareData
ElseIf cb = "Delete Charcters" Then
Call DeleteCharcters
ElseIf cb = "Number Cells 1-25" Then
Call NumberCells
ElseIf cb = "Number Cels Value 001" Then
Call NumberCellsValue
ElseIf cb = "Find Blank Cells" Then
Call FindBlankCell
ElseIf cb = "Fill Selection Copy" Then
Call Selection.FillDown
ElseIf cb = "Fill Selection Series" Then
Call FillSelection_Series
End If
End Sub


All of my elseif has the same name as my UserForm_Initialize. How can
I use the UserForm_Initialize varData array in my command button so
that I do not have to type the list twice?


Thank you for your help,
jfcby


Hello All responders,

Thank you for your help. Problem was solved with Tom's select case
response.

jfcby



 
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
UserForm List Box, Excel 2000 & 2003 jfcby[_2_] Excel Programming 5 February 19th 07 01:04 AM
UserForm Question, Excel 2000 & 2003 jfcby[_2_] Excel Programming 2 February 13th 07 12:21 PM
Sin Button run macro Excel 2000 - 2003 jfcby[_2_] Excel Programming 1 December 11th 06 02:26 PM
How do I setup a print command button in excel 2003 BigPunchy New Users to Excel 1 December 24th 04 11:54 PM
Userform disappears when you try to initialize from a command button RPIJG[_60_] Excel Programming 8 July 2nd 04 08:14 PM


All times are GMT +1. The time now is 10: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"