B
Bill95051
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.
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.