Lastrow
LastRow is just the name of a variable that can be assigned any value:
LastRow=1
or
LastRow=5+7
The formula you posted just assigns it to the last filled cell in some
column. To set LastRow to the first cell in column A that has the value of
zero:
Sub marine()
For i = 1 To Rows.Count
If Cells(i, "A").Value = 0 Then
LastRow = i
Exit For
End If
Next
' more code here
End Sub
--
Gary''s Student - gsnu200852
"Bishop" wrote:
I'm familiar with this code to find the last row:
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
But what if I need LastRow to be at a certain value? If I know column A is
going to have data and I want to assign LastRow the first row that has a
value of 0 how would I do that? What if I need LastRow to be the row 2 rows
above the first row that has a value of 0?
|