LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Sum a column using fixed start cell and variable end cell

I am trying to use code using a fixed starting point and a variable end point

the code I am using is this

Dim lastrow4 As Long
lastrow4 = ActiveSheet.Cells(Rows.Count, "b").End(xlUp).Row * -1
Range("D" & lastrow2) = "=SUM(R[lastrow4]C:R[-1]C)"
Range("E" & lastrow2) = "=SUM(R[lastrow4]C:R[-1]C)"

the idea is that lastrow4 is the lastrow, in code if it was a fixed start
and end point it would read

Dim lastrow2 As Long, lastrow4 As Long
lastrow4 = ActiveSheet.Cells(Rows.Count, "b").End(xlUp).Row * -1
lastrow2 = ActiveSheet.Cells(Rows.Count, "b").End(xlUp).Row + 1
Range("D" & lastrow2) = "=SUM(R[-63]C:R[-1]C)"


the first cell in the calculation is always D7 or E7 etc but the ending cell
is variable, any help is as alway appreciated


 
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
find first empty cell in column and start transpose next row in that cell ali Excel Discussion (Misc queries) 6 July 21st 07 11:55 PM
Fixed column, variable rows Vasilis Tergen Excel Programming 5 December 3rd 06 02:14 AM
Fixed column- Variable row # Vasilis Tergen Excel Discussion (Misc queries) 3 December 2nd 06 06:10 PM
From a fixed cell to a variable [email protected] Excel Programming 8 July 21st 06 02:14 PM
reference cell value from fixed column with variable row bob z Excel Discussion (Misc queries) 0 May 23rd 05 11:30 PM


All times are GMT +1. The time now is 10:03 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"