Hello everyone,
In column "A", I have a very large number of empty and non-empty cells, how can we quickly select the 10 non-empty cells in this column "A".
I've put together a little macro that does the job, but it takes a long time to run.
How can we do this more efficiently.
I want a solution in VBA, no formula please.
Thanks in advance.
Here is the Macro.
In column "A", I have a very large number of empty and non-empty cells, how can we quickly select the 10 non-empty cells in this column "A".
I've put together a little macro that does the job, but it takes a long time to run.
How can we do this more efficiently.
I want a solution in VBA, no formula please.
Thanks in advance.
Here is the Macro.
VBA Code:
Private Sub CommandButton2_Click
Application.ScreenUpdating = False
Dim lastRow As Long
Dim Count As Integer
Dim Row As Integer
Count = 0
Row = 1
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Do While Row <= lastRow
If Not (Cells(Row, 1) = "") Then
Count = Count + 1
End If
Row = Row + 1
If Count = 10 Then
Range("A" & Row).Select
End If
Loop
Application.ScreenUpdating = True
End Sub