#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default dynamic sum

I have just had to deal with the same issue and this is what I did

Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
i = Selection.Rows.Count
ActiveSheet.Range("g1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-" & i & "]C:R[-1]C)"



"E" wrote in message
...
I have a spreadsheet that recieves data from MS Access. The number of rows
and columns changes from month to month. I want to run the totals of each
row. The totals will appear at the end of row. I've managed to get part
of
it. I can't seem to get the dynamic part of the sum. In other words the
number of rows is hard coded. Here is my code:

Dim test As String
Dim Test2 As String
Dim lastrow As String

lastrow = ActiveSheet.UsedRange.Rows.Count
Test2 = ActiveSheet.UsedRange.Columns.Count
test = "B" & lastrow

Range("B2:" & test).Select
Range("B" & (lastrow + 1)).Activate
ActiveCell.FormulaR1C1 = "=SUM(R[-1]C:R[-10]C)"


End Sub



Reply
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
Dynamic pivot table linked to dynamic excel spreadsheets FErd Excel Worksheet Functions 0 April 29th 10 10:44 PM
Dynamic chart pasted to a new workbook in report can't be dynamic Piotr (Peter)[_2_] Charts and Charting in Excel 2 August 6th 08 05:15 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Charts and Charting in Excel 0 March 1st 06 01:05 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Excel Programming 0 March 1st 06 01:05 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM


All times are GMT +1. The time now is 12:16 PM.

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

About Us

"It's about Microsoft Excel"