Forum Discussion

hrh_dash's avatar
hrh_dash
Iron Contributor
Aug 05, 2022

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 ...
  • HansVogelaar's avatar
    Aug 05, 2022

    hrh_dash 

    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))")

Resources