ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using a variable length list to poplate a List Box (https://www.excelbanter.com/excel-programming/426745-using-variable-length-list-poplate-list-box.html)

RocketRod

using a variable length list to poplate a List Box
 
I have a spreadsheet with a list of values which can be modified by others
with extra entries.
I need to populate t a List Box with all the entries taking into account how
many there are now in the list.
Is there a way to automatically set/update the number of entries in the list
as it jumps down to the next row as long as the next row is not blank?

JLGWhiz[_2_]

using a variable length list to poplate a List Box
 
'You can use a variable to identify the last row of the range. Assume that
your RowSource or ListFillRange is in Column A:

lasrRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

'Then Set an object variable to represent the dynamic range:

Set myRowSrc = ActiveSheet.Range("A2: A" 7 lastRow)

'To use this effectively, you would need to place the Set statement in the
code so that if your range is changed using a loop, the Set statement will
re-initialize on each iteration of the loop. Otherwise, it would be the
same as assigning a static range for RowSource.


"RocketRod" wrote in message
...
I have a spreadsheet with a list of values which can be modified by others
with extra entries.
I need to populate t a List Box with all the entries taking into account
how
many there are now in the list.
Is there a way to automatically set/update the number of entries in the
list
as it jumps down to the next row as long as the next row is not blank?





All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com