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: 1
Default Repeating macro with dynamic range

Good afternoon experts,

I need help with an Excel macro.

My data looks like this:
A B
1
2 5
3 6
4
5 2
6 4
7 10
8

I want a macro to insert the following formulas:
B1 - "= Sum(A2:A3)"
B4 - "= Sum(A5:A7")"
etc.

The result will be:
A B
1 11
2 5
3 6
4 16
5 2
6 4
7 10
8

I recorded the following macro but the range is static so it only works
once:
Sub Totals()
'
' Totals Macro
' Macro recorded 9/30/2005 by DJ
'
Range("S2973").Select
Selection.End(xlUp).Select
Range("T2968").Select
ActiveCell.FormulaR1C1 = "=SUM(R[1]C[-1]:R[5]C[-1])"
End Sub


What VB syntax will make it repeat indefinitely?

Thanks in advance,
Don Jellie

 
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 Range Name Macro Jonathan Cooper Excel Discussion (Misc queries) 3 March 24th 08 09:04 PM
How do I create a dynamic range in a macro Mark2122 Excel Worksheet Functions 2 February 2nd 07 09:44 PM
Sum on Dynamic Data Range - Macro [email protected] Excel Programming 1 August 26th 05 06:32 AM
Dynamic Range in Macro with R1C1 Jonnyboy117 Excel Programming 3 July 9th 04 04:40 PM
Dynamic range in graphing macro Colin Macleod Excel Programming 2 November 1st 03 06:26 AM


All times are GMT +1. The time now is 09:35 AM.

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"