Starkey
Board Regular
- Joined
- May 5, 2006
- Messages
- 187
Hi everyone. Not posted for ages but still read the threads when I need help which I continue to find very useful
I've just discovered the RowSouce property of ListBoxes and it's opened up a wealth of new possibilities. However I'm struggling in scenarios where I want to populate a ListBox with several columns, one of which has a header but no values in it
So imagine a worksheet with 3 columns. I've inserted the headers of each of these columns in the first row (ID, Description, Data Type). I've done this because I've set the ColumnHeads property to TRUE
My data sits between rows 2 and 50. All 49 cells are populated for columns 1 (ID) and 2 (Description) but not one cell is populated for column 3 (Data Type) because it's not a mandatory field. I've set the RowSource as follows:
With Sheets("STAGING")
ListBox3.RowSource = "'" & .Name & "'!" & .Range("A2", .Cells(1048576, A).End(xlUp)).Address
End With
Where A = Application.WorksheetFunction.CountA(Sheets("STAGING").Rows("1:1")) (i.e. 3)
So I expected RowSource to be A2:C50 but instead it's A2:B2
Any idea where I'm going wrong please?
Many thanks
I've just discovered the RowSouce property of ListBoxes and it's opened up a wealth of new possibilities. However I'm struggling in scenarios where I want to populate a ListBox with several columns, one of which has a header but no values in it
So imagine a worksheet with 3 columns. I've inserted the headers of each of these columns in the first row (ID, Description, Data Type). I've done this because I've set the ColumnHeads property to TRUE
My data sits between rows 2 and 50. All 49 cells are populated for columns 1 (ID) and 2 (Description) but not one cell is populated for column 3 (Data Type) because it's not a mandatory field. I've set the RowSource as follows:
With Sheets("STAGING")
ListBox3.RowSource = "'" & .Name & "'!" & .Range("A2", .Cells(1048576, A).End(xlUp)).Address
End With
Where A = Application.WorksheetFunction.CountA(Sheets("STAGING").Rows("1:1")) (i.e. 3)
So I expected RowSource to be A2:C50 but instead it's A2:B2
Any idea where I'm going wrong please?
Many thanks