DonAndress
Active Member
- Joined
- Sep 25, 2011
- Messages
- 362
- Office Version
- 2019
- 2016
- Platform
- Windows
Hello.
I'm trying to prepare a UserForm with a list of cells - easy.
Now, I need to add a button to select all non-empty cells from the ListBox1.
I know that the list always starts from cell A4, I don't know how long the list is (each macro run may generate different amount of values), there are no empty cells between cells with values.
Right now I have it defined in the ListBox1 properties: RowSource = Sheet1!A4:A100
Then a default code for a button:
But it selects all 96 cells defined above.
How do I limit only to non-empty cells?
I'm trying to prepare a UserForm with a list of cells - easy.
Now, I need to add a button to select all non-empty cells from the ListBox1.
I know that the list always starts from cell A4, I don't know how long the list is (each macro run may generate different amount of values), there are no empty cells between cells with values.
Right now I have it defined in the ListBox1 properties: RowSource = Sheet1!A4:A100
Then a default code for a button:
Code:
For i = 0 to ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
But it selects all 96 cells defined above.
How do I limit only to non-empty cells?