Results 1 to 3 of 3

Macro insert rows if column changes + add subtotal

Threaded View

  1. #1
    Registered User
    Join Date
    08-01-2011
    Location
    Spain
    MS-Off Ver
    Excel 2003
    Posts
    5

    Macro insert rows if column changes + add subtotal

    Hi,

    I have not big idea about macros, only formulas, and I can't do what I need with them so would be great if you can help me buiding a macro for it. What I need is

    1. To leave the first 8 rows free
    2. In the table, I need 2 rows to be inserted everytime the reference from column G changes
    3. Finally, to add in first inserted row a subtotal adding up figures from columns from O to S.

    In "sheet 1" there's an example of the initial table I have, and in "sheet 2" example of the outcome I want.

    I tried with the following but it only adds 1 row and don't know how to do the subtotal:

    Dim lngRow As Long, intRow As Long

    lngRow = Cells(Rows.Count, 7).End(xlUp).Row
    For intRow = lngRow To 2 Step -1
    If Cells(intRow, 7).Value <> Cells(intRow - 1, 7).Value Then _
    Rows(intRow).Resize(1).Insert

    Next intRow
    Thanks!!Insert rows Macro.xls
    Last edited by twomind; 01-21-2014 at 11:53 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA Macro - Insert Rows based on different Column Value but Ignoring Blanks Cells
    By WITJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-12-2013, 03:11 PM
  2. [SOLVED] Need Help w/Macro that Insert Rows, Copy Row, and Transpose to Column
    By hiroki3296 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2012, 10:27 AM
  3. Replies: 8
    Last Post: 07-31-2012, 09:41 AM
  4. A macro to insert 2 rows above a Subtotal
    By red flower in forum Excel General
    Replies: 1
    Last Post: 10-07-2011, 08:53 PM
  5. [SOLVED] macro to Insert rows at every change in a column
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1