Hey everyone.
I have an excel workbook that contains two sheets (databases) and a UserForm. On the UserForm, I have a ComboBox. What I want to do is to set a dynamic range in "Sheet2" as a RowSource for the ComboBox. Actually I am able to set it, but if I am on "Sheet1" ComboBox takes its RowSource values from "Sheet1" although I defined "Sheet2" in my code. Here is the code:
Any help would be appreciated.
Thanks in advance.
I have an excel workbook that contains two sheets (databases) and a UserForm. On the UserForm, I have a ComboBox. What I want to do is to set a dynamic range in "Sheet2" as a RowSource for the ComboBox. Actually I am able to set it, but if I am on "Sheet1" ComboBox takes its RowSource values from "Sheet1" although I defined "Sheet2" in my code. Here is the code:
Code:
Dim r As Range
With Worksheets("Sheet2")
Set r = .Range("B2", .Range("B65536").End(xlUp))
End With
ComboBox1.RowSource = r.Address
Any help would be appreciated.
Thanks in advance.