If I may, this is a better way to do what you're trying, since it looks from the second row all the way until the last row. It'll stop when it finds the first two cells that are both empty.
Sub findTwoEmptyCells()
Dim lastRow As Long, i As Long
Dim firstEmptyCell As Range
lastRow = Cells(Rows.Count, 1).End(xlUp).Row ' Assuming your column A has the most data or is the row you want to check.
For i = 1 To lastRow
If Cells(i, 1).Value = "" And Cells(i, 1).Offset(1, 0).Value = "" Then
Set firstEmptyCell = Cells(i, 1)
Exit For
End If
Next i
'Now, you have a cell, firstEmptyCell, which you can do things with, i.e.
firstEmptyCell.Value = "Empty!"
End Sub
Edit: Also, in the even there are no two empty cells in a row, add this before firstEmptyCell.Value
:
If firstEmptyCell Is Nothing Then ' If there are no two empty cells in a row, exit the sub/do whatever you want
MsgBox ("There are no two empty cells in a row")
Exit Sub
End If
Edit2: As @MatsMug points out, this will work fine assuming you don't change/use multiple worksheets. If you do, add the sheet name before Cells()
, i.e. Sheets("Sheet1").Cells(...)
.