nuttycow13
New Member
- Joined
- Feb 6, 2012
- Messages
- 47
Hi i have 3 comboboxes and want the last to to read a different Worksheet dependent on what the input is in the first combobox is this possible and if so how is it done ?? the code i have so far is:
Private Sub UserForm_Initialize()
Dim Site As Range
Dim Location As Range
Dim Printer_Type As Range
Dim ws As Worksheet
Set ws = Worksheets("LookUp USSD")
For Each Site In ws.Range("Site")
With Me.Sitebox
.AddItem Site.Value
End With
Next Site
If Sitebox = "UKCH" Then
Sheet2.Activate
ElseIf Sitebox = "SDHQ" Then
Sheet1.Activate
ElseIf Sitebox = "NLEI" Then
Sheet13.Activate
ElseIf Sitebox = "USHW" Then
Sheet10.Activate
ElseIf Sitebox = "SGSG" Then
Sheet11.Activate
End If
For Each Location In ws.Range("location")
With Me.Locationbox
.AddItem Location.Value
End With
Next Location
For Each Printer_Type In ws.Range("Type")
With Me.Printer_Type_box
.AddItem Printer_Type.Value
End With
Next Printer_Type
End Sub
this does not seem to work and i cant figure out how to do this.
Thanks in advance.
Private Sub UserForm_Initialize()
Dim Site As Range
Dim Location As Range
Dim Printer_Type As Range
Dim ws As Worksheet
Set ws = Worksheets("LookUp USSD")
For Each Site In ws.Range("Site")
With Me.Sitebox
.AddItem Site.Value
End With
Next Site
If Sitebox = "UKCH" Then
Sheet2.Activate
ElseIf Sitebox = "SDHQ" Then
Sheet1.Activate
ElseIf Sitebox = "NLEI" Then
Sheet13.Activate
ElseIf Sitebox = "USHW" Then
Sheet10.Activate
ElseIf Sitebox = "SGSG" Then
Sheet11.Activate
End If
For Each Location In ws.Range("location")
With Me.Locationbox
.AddItem Location.Value
End With
Next Location
For Each Printer_Type In ws.Range("Type")
With Me.Printer_Type_box
.AddItem Printer_Type.Value
End With
Next Printer_Type
End Sub
this does not seem to work and i cant figure out how to do this.
Thanks in advance.