LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing value of variant Andrew Excel Programming 3 May 22nd 06 03:16 AM
Variant owl527[_5_] Excel Programming 2 October 14th 05 09:37 PM
using find with variant? Don S Excel Programming 4 August 16th 05 04:52 PM
Ron, I found some code that works with Lotus Notes Tim Excel Programming 5 August 1st 05 03:12 PM
Find Variant StephanieH Excel Programming 7 February 23rd 05 03:48 PM


All times are GMT +1. The time now is 10:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"