+ Reply to Thread
Results 1 to 9 of 9

insert blank row and header copy

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    Lehigh Valley, PA
    MS-Off Ver
    Excel 2007
    Posts
    18

    insert blank row and header copy

    Looking for a Excel 2007 macro that will do the following:

    Loop through data in column C
    When the data in column C changes
    insert a blank row followed by a row that contains a copy of the header

    Other Info:
    Single Sheet
    Header (Row 2)
    Variable Number of rows
    100+ columns (A:BZ)

    Thank You!
    Last edited by msmick; 10-29-2011 at 01:54 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: insert blank row and header copy

    Hello msmick,

    Welcome to the Forum!

    This macro will do what you asked for.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-28-2011
    Location
    Lehigh Valley, PA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: insert blank row and header copy

    Thanks Leith,

    Tried running it and got a Run-time error 13: type mismatch
    when it got to:

    Please Login or Register  to view this content.
    Mark

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: insert blank row and header copy

    Hello Mark,

    I don't have an answer to that. I have varied data on the worksheet and can not reproduce the error.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: insert blank row and header copy

    Hello Mark,

    Can you post the workbook?

    To Attach a File:
    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  6. #6
    Registered User
    Join Date
    10-28-2011
    Location
    Lehigh Valley, PA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: insert blank row and header copy

    Ok Leith,

    Hope I did this correctly.

    Would it matter if all my macros are run from the personal.xlsb file?
    Attached Files Attached Files

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: insert blank row and header copy

    Hello Mark,

    Thanks for posting the workbook.Found the problem. The macro was expecting row 1 to have the headers. You started the headers in row 2. I changed the macro. Here is the update code. It ran correctly on the posted workbook.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-28-2011
    Location
    Lehigh Valley, PA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: insert blank row and header copy

    Very nice Leith,
    Thanks for hanging in there with me. Much appreciated.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: insert blank row and header copy

    Hello Mark,

    You're welcome. Thanks for marking the post "Solved". I will remember the cause of this problem for the future.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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