edjohns
09-20-2012, 09:20 AM
hi,
i am trying to populate a combobox in a userform with a range from a sheet, the problem is, the combobox
is filled with rows from the active sheet rather than the one i am defining.
here's the code
Sub UserForm_Activate()
Dim sheet As Worksheet
Dim defectos As Range
Set sheet = ThisWorkbook.Worksheets("VALUES")
With sheet
Set defectos = .Range(.Range("F2"), .Range("F2").End(xlDown))
End With
cbb_defectos.RowSource = defectos.Address
End Sub
it doesn't give any errors but instead of using the specified range in worksheets("values") it getsthe row source property from that range in the active worksheet (which is not what i want). i dont think
i can activate "values" sheet because this user form performs some routines on the original sheet, which is the one where its getting the row source from with this code.
thank you.
i am trying to populate a combobox in a userform with a range from a sheet, the problem is, the combobox
is filled with rows from the active sheet rather than the one i am defining.
here's the code
Sub UserForm_Activate()
Dim sheet As Worksheet
Dim defectos As Range
Set sheet = ThisWorkbook.Worksheets("VALUES")
With sheet
Set defectos = .Range(.Range("F2"), .Range("F2").End(xlDown))
End With
cbb_defectos.RowSource = defectos.Address
End Sub
it doesn't give any errors but instead of using the specified range in worksheets("values") it getsthe row source property from that range in the active worksheet (which is not what i want). i dont think
i can activate "values" sheet because this user form performs some routines on the original sheet, which is the one where its getting the row source from with this code.
thank you.