![]() |
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 |
Using found variant within code
Hi Ron
Try ActiveCell = Application.SumIf(Range("B2:B" & lasty), "jk", Range("AP2:AP" & lasty)) -- Regards Roger Govier "Ron Dean" wrote in message . nl... 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 |
Using found variant within code
ActiveCell = Application.SumIf(Range("B2:B"&lasty), "jk",
Range("AP2:AP"&lasty)) Regards, Stefi €˛Ron Dean€¯ ezt Ć*rta: 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 |
All times are GMT +1. The time now is 03:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com