selraith
11-10-2007, 03:49 PM
Hi is it possible to assign the a specific line within the combobox with a macro or even a code??
for example:
With Me.ComboBox1
.AddItem ("Package One")
Then assigning this with a maco (call module1.helpme) or Sheets("Boot Screen").Select
The full code can be seen below:
Option Explicit
Private Sub cmdCancel_Click()
'Unload the userform
Unload Me
End Sub
Private Sub cmdOkay_Click()
'Verify that an item was selected
If Me.ComboBox1.BoundValue = vbNullString Then
MsgBox "You did not choose an item!", vbOKOnly
Else
MsgBox "You choose " & Me.ComboBox1.BoundValue, vbOKOnly
End If
Unload Me
End Sub
Private Sub ComboBox1_Change()
End Sub
Private Sub UserForm_Initialize()
'Load the combobox with a variety of household pets
With Me.ComboBox1
.AddItem ("Package One")
.AddItem ("Package Two")
.AddItem ("Package Three")
.AddItem ("Package Four")
.AddItem ("Package Five")
.AddItem ("Package Six")
.AddItem ("Package Seven")
.AddItem ("Package Eight")
.AddItem ("Package Nine")
.AddItem ("Show All")
End With
End Sub
TIA
Thanks in Advance
for example:
With Me.ComboBox1
.AddItem ("Package One")
Then assigning this with a maco (call module1.helpme) or Sheets("Boot Screen").Select
The full code can be seen below:
Option Explicit
Private Sub cmdCancel_Click()
'Unload the userform
Unload Me
End Sub
Private Sub cmdOkay_Click()
'Verify that an item was selected
If Me.ComboBox1.BoundValue = vbNullString Then
MsgBox "You did not choose an item!", vbOKOnly
Else
MsgBox "You choose " & Me.ComboBox1.BoundValue, vbOKOnly
End If
Unload Me
End Sub
Private Sub ComboBox1_Change()
End Sub
Private Sub UserForm_Initialize()
'Load the combobox with a variety of household pets
With Me.ComboBox1
.AddItem ("Package One")
.AddItem ("Package Two")
.AddItem ("Package Three")
.AddItem ("Package Four")
.AddItem ("Package Five")
.AddItem ("Package Six")
.AddItem ("Package Seven")
.AddItem ("Package Eight")
.AddItem ("Package Nine")
.AddItem ("Show All")
End With
End Sub
TIA
Thanks in Advance