I have a simple exel worksheet, there're 2 rows not empty for example 2 first rows have some text in column A. How could I find an empty row (eg 3rd) and put there something.
Crusader,
To do this I named a range of cells "TestRange". then used this code. This works ONLY if everything in the range is text. If the cells contain numbers, then change the IF statement to look at the cells value. When it finds the next empty cell, that will be the one selected.
Sub FindNextEmptyCell()
Dim i As Integer
For i = 1 To Sheet1.Range("TestRange".Cells.Count - 1
If ActiveCell.Characters.Count > 0 Then
ActiveCell.Offset(1, 0).Activate
Else
MsgBox "This cell is empty"
Exit Sub
i = i + 1
End If
Next i
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.