How to populate comboboxes with range from a different worksheet?

aaronlive

New Member
Joined
Dec 23, 2009
Messages
8
I wonder if anyone can help me. I'm trying to load the comboboxes with data from a different worksheet. However, no matter what code I try it only loads from the active sheet. Here's an example of one of the subs that I tried.

Any help would be greatly appreciated!



Private Sub ComboBox1_Change()

If ComboBox1.Value = "" Then
ComboBox2.Clear
ElseIf ComboBox1.Value = "Income" Then

ComboBox2.RowSource = Worksheets("Sheet3").Range("F1", "F5").Address

ElseIf ComboBox1.Value = "Costs" Then
ComboBox2.RowSource = Worksheets("Sheet3").Range("G1", "G5").Address
End If

End Sub
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,392
Office Version
365
Platform
Windows
You need to include the sheet name.
Code:
Combobox2.RowSource = "Sheet3!F1:F5"
 

Forum statistics

Threads
1,085,574
Messages
5,384,537
Members
401,906
Latest member
IvayloKonsulov

Some videos you may like

This Week's Hot Topics

Top