davedave24
Programmer
Hi
I need to add a dynamically sized range from a row in excel into a listbox (column 1).
The range will always start at G1, and end at whatever the last used cell is in row 1.
I can do this fine when adding a column using this method:
However it doesn't work for the Row. I've tried to modify it to this:
But with that, it only picks up the first entry (cell G1)
I need to add a dynamically sized range from a row in excel into a listbox (column 1).
The range will always start at G1, and end at whatever the last used cell is in row 1.
I can do this fine when adding a column using this method:
Code:
Dim rngC As Range
With Sheets("Customers")
Set rngC = .Range(.Range("A2"), .Cells(Rows.Count, 1).End(xlUp))
End With
comboCustomer.RowSource = rngC.Address(External:=True)
However it doesn't work for the Row. I've tried to modify it to this:
Code:
Set rngC = .Range(.Range("G1"), .Cells(1, Columns.Count).End(xlToRight))
But with that, it only picks up the first entry (cell G1)