LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2
Default Inserting blank rows plus using Sum

I have a list of stocks sorted by date. When the stock symbol changes, I
need to insert 2 blank rows and AutoSum columns 2, 6,7, and 8 of the group
and display them on the first of the 2 blank rows, leaving a blank row before
the next group.

Symbol Qty Price Action Name US Trade Date Amount Commission Fees
MSFT -210 28.95 Sell 2/13/2008 6079.43 -0.07 -0.07
MSFT -790 28.95 Sell 2/13/2008 22863.24 -7.26 -0.26
-1000 28942.67 -7.33 -0.33

C -700 22.16 Sell 3/4/2008 15511.82 -0.18 -0.18
C -300 22.15 Sell 3/4/2008 6637.92 -7.08 -0.08
-1000 22149.74 -7.26 -0.26

MSFT -500 27.5712 Sell 3/4/2008 13785.44 -0.16 -0.16
MSFT -440 27.57 Sell 3/4/2008 12130.66 -0.14 -0.14
MSFT -60 27.57 Sell 3/4/2008 1647.18 -7.02 -0.02
-1000 27563.28 -7.32 -0.32

WM -700 12.01 Sell 3/13/2008 8406.9 -0.1 -0.1
WM -70 12.01 Sell 3/13/2008 840.69 -0.01 -0.01
WM -600 12.01 Sell 3/13/2008 7205.92 -0.08 -0.08
WM -30 12.01 Sell 3/13/2008 353.29 -7.01 -0.01
WM -600 12.01 Sell 3/13/2008 7205.92 -0.08 -0.08

I modified "Inserting a Row (update)", by Tom (General Questions) to insert
a second row, but am stumped about adding SUM for the Qty, Amount,
Commission, and Fees (columns 2, 6,7, and 8) while doing so.

Sub SumAndSeparate() ' originally called "InsertRows"
StartRow = 3 'Change the 2 to the row actual data start
DataColumn = 1 'Change the 1 to the column where your data is

i = StartRow + 1
While Cells(i, DataColumn) < ""
If Cells(i, DataColumn) < Cells(i - 1, DataColumn) Then
Cells(i, DataColumn).EntireRow.Insert
Cells(i, DataColumn).EntireRow.Insert ' a 2nd blank row added
i = i + 2
End If
i = i + 1
Wend

End Sub

I am using Excel 2007 but need to export it to MS Works when finished (which
shouldn't matter too much since most of the work is done in Excel). If the
needed actions can be added on/in to the macro above, that would be great.
I'll be able to understand it. While I \have programmed before, I have no
background in Visual Basic and my macro talents are fossilized.

 
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
Inserting Blank rows between items JB Excel Discussion (Misc queries) 6 June 5th 08 01:06 PM
Macro Help- Inserting Blank Rows jack Excel Discussion (Misc queries) 3 January 16th 07 09:43 PM
Inserting blank rows in Excel. kwm5321 Excel Discussion (Misc queries) 3 December 1st 06 12:19 AM
Inserting Blank rows after every row upto 2500 rows Manju Excel Worksheet Functions 8 August 22nd 06 12:54 PM
Inserting Blank Rows Macro? Michael Saffer Excel Worksheet Functions 2 November 9th 04 06:23 PM


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