Using found variant within code
If I use this code to find last used row in a worksheet,
Sub Last_Row()
Dim lasty As Long
lasty = Range("AP" & Rows.Count).End(xlUp).Row
MsgBox lasty
End Sub
how do I use "lasty" in this line of code to replace the row 200
ActiveCell = Application.SumIf(Range("B2:B200"), "jk", Range("AP2:AP200"))
ie I only want to sum used rows
|