Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Macro to insert sum calculation at every second blank cell for data above in column F

Hi

As the subject says

My data is like

Column A Column F
John 100.00
10.00
Total 110.00
Blank Row
Smith 100.00
10.00
Total 110.00
Blank Row


I have two blank rows between every part of my data,

I need to insert a sum formula to sum all the above to the previous
sum formula.

I already tried the edit go to special cells and used the sum button
but it inserted the formula in every blank cell for the column making
my data wrong,

I hope someone can help and I am being clear,

Thanks so much

Andrea

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Macro to insert sum calculation at every second blank cell for data above in column F

On Jul 11, 1:40 pm, "
wrote:
Hi

As the subject says

My data is like

Column A Column F
John 100.00
10.00
Total 110.00
Blank Row
Smith 100.00
10.00
Total 110.00
Blank Row

I have two blank rows between every part of my data,

I need to insert a sum formula to sum all the above to the previous
sum formula.

I already tried the edit go to special cells and used the sum button
but it inserted the formula in every blank cell for the column making
my data wrong,

I hope someone can help and I am being clear,

There are many ways to do what you want. Here is a fairly simple way
that may help you see what you need to do.

Hope this helps

Peter


dim currRow as long
dim blankCount as integer
dim totalStr as string

totalStr="="
blankCount=0
currRow=1
While blankCount < 4
if (isempty(cells(currRow,6))) then
blankCount=blankCount+1
else
blankCount=0
if (cells(currRow,1)="Total") then
totalStr=totalStr+"+F"+format(currRow)
end if
end if
currRow=currRow+1
wend

cells(currRow,1)="Grand Total"
cells(currRow,6)=totalStr


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
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... [email protected][_2_] Excel Programming 2 June 7th 07 09:27 PM
How do I create a Macro to sort data and insert blank rows & subto karinmpfa Excel Worksheet Functions 2 April 25th 06 09:57 PM
Macro code to test for blank row and insert blank row if false Mattie Excel Programming 2 March 29th 06 01:19 AM
insert a blank row after data changes in a column cyndi Excel Discussion (Misc queries) 2 October 24th 05 02:46 PM


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