Combobox to populate another combobox

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.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top