Forum Discussion
hrh_dash
Aug 05, 2022Iron Contributor
vba to find last row with value not equals to 0
I would like to have a code to find last row that does not equals to 0. Based on the screenshot, using the debug.Print, it should print row 34 for column Q. thanks and appreciate the ...
- Aug 05, 2022
Alternatively, let Excel figure it out by evaluating a formula:
LastRowNonZero = [MAX((Q2:Q1000<>0)*ROW(Q2:Q1000))]
or
LastRowNonZero = Evaluate("MAX((Q2:Q1000<>0)*ROW(Q2:Q1000))")
NikolinoDE
Aug 05, 2022Platinum Contributor
Sub LastRowNotEqualZero()
Dim LastCell As Long
Dim i As Long
LastCell = Cells(Rows.Count, 1).End(xlUp).Row
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i, 1) <> "0" Then 'here then like formula
next i
end sub
hope i could help 🙂
I know I don't know anything (Socrates)
hrh_dash
Aug 05, 2022Iron Contributor
appreciate the help anyways!