using a variable length list to poplate a List Box

  • Thread starter Thread starter RocketRod
  • Start date Start date
R

RocketRod

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?
 
'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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top