View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Dean[_2_] Ron Dean[_2_] is offline
external usenet poster
 
Posts: 12
Default 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