Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default insert sum when first blank cell found

I have data in a worksheet.

I have two rows between each of my lines of data.

What I need is a macro to insert a sum calculation for everything
above until the last sum calculation. The numbers are contained in
column A

I hope this makes sense.

Thanks

Andrea

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default insert sum when first blank cell found

You have something like this

1 5
2 6
3 =sum(a1:a2)
4
5 7
6 8
7 =sum(A3:a6)
8
9 35
10 36
11 =sum(a7:a10)

if you copy =sum(a3:a6) and past it in all the first blank rows it will
automatically increment to meet your requirements.

" wrote:

I have data in a worksheet.

I have two rows between each of my lines of data.

What I need is a macro to insert a sum calculation for everything
above until the last sum calculation. The numbers are contained in
column A

I hope this makes sense.

Thanks

Andrea


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default insert sum when first blank cell found

I wanted a macro to do this automatically.....


Rather than me do it manually.....


Thanks

Andrea


On 31 May, 12:49, Joel wrote:
You have something like this

1 5
2 6
3 =sum(a1:a2)
4
5 7
6 8
7 =sum(A3:a6)
8
9 35
10 36
11 =sum(a7:a10)

if you copy =sum(a3:a6) and past it in all the first blank rows it will
automatically increment to meet your requirements.



" wrote:
I have data in a worksheet.


I have two rows between each of my lines of data.


What I need is a macro to insert a sum calculation for everything
above until the last sum calculation. The numbers are contained in
column A


I hope this makes sense.


Thanks


Andrea- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default insert sum when first blank cell found

Try this

Sub copysum()

EndRow = Cells(Rows.Count, "A").End(xlUp).Row

FirstRow = 1
RowCount = 1
Do While RowCount <= EndRow + 1

If IsEmpty(Cells(RowCount, "A")) Then

LastRow = RowCount - 1
Cells(RowCount, "A").FormulaR1C1 = _
"=SUM(R" & CStr(FirstRow) & "C1:R" & _
CStr(LastRow) & "C1)"

FirstRow = RowCount
RowCount = RowCount + 1

End If

RowCount = RowCount + 1
Loop

End Sub


" wrote:

I wanted a macro to do this automatically.....


Rather than me do it manually.....


Thanks

Andrea


On 31 May, 12:49, Joel wrote:
You have something like this

1 5
2 6
3 =sum(a1:a2)
4
5 7
6 8
7 =sum(A3:a6)
8
9 35
10 36
11 =sum(a7:a10)

if you copy =sum(a3:a6) and past it in all the first blank rows it will
automatically increment to meet your requirements.



" wrote:
I have data in a worksheet.


I have two rows between each of my lines of data.


What I need is a macro to insert a sum calculation for everything
above until the last sum calculation. The numbers are contained in
column A


I hope this makes sense.


Thanks


Andrea- Hide quoted text -


- Show quoted text -




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
How to insert a slash into a blank cell Claudia New Users to Excel 1 August 13th 09 02:41 PM
if cell is blank insert a zero JK Excel Discussion (Misc queries) 3 October 24th 07 03:09 PM
Insert blank row above populated cell Bevy Excel Programming 3 June 6th 06 03:02 PM
Insert Blank Line after the Word Category is found Nigel Excel Programming 2 March 1st 06 05:49 PM
insert blank row when cell changes Ivano Excel Programming 3 September 24th 05 04:15 AM


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