+ Reply to Thread
Results 1 to 4 of 4

macro to add empty rows before and after specific rows

  1. #1
    Registered User
    Join Date
    12-01-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    2

    macro to add empty rows before and after specific rows

    hello,
    I am new to this forum and need "some" help. I am not a very experienced Excel user but need to convert a lot of files from Excel tot a SQL database. Thefore I need to insert rows in exsisting Excel files otherwise the rest of the conversion will not work.
    There must be 1 row inserted before and after every row that contains an "Underline" mark up.
    I think it is dificult to explain wat I need but maybe the two files that I attached make it clear.
    File version 1 is the state of the file before and version 2 is the result I need.
    Normaly the files can contain thousands of rows.

    I hope you can help me.

    Thanks in advance,

    With kind regards.

    Fred

    version 1.xlsm version 2.xlsm

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: macro to add empty rows before and after specific rows

    Hi there,

    Take a look at the attached workbook and see if it does what you need. It contains the following code:

    Please Login or Register  to view this content.
    The value of the constant used to indicate the data column can be altered to suit any change in the layout of your worksheet.

    When performing operations like this it is important to ensure that the variables you're using to track your progress through the data rows remain accurate even while new rows are being inserted. For this reason the scan process begins at the bottom of the data column and progresses upwards towards the top - any new rows are inserted below the row currently being checked, so the row tracker always remains accurate.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M


    P.S. My compliments on the clear way in which you explained your requirements - it made finding a solution that much easier
    Last edited by Greg M; 12-01-2014 at 12:43 PM. Reason: P.S. added

  3. #3
    Registered User
    Join Date
    12-01-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    2

    Thumbs up Re: macro to add empty rows before and after specific rows

    Hi Greg,

    this is absolutely briljant, and exactly what I mean! Thank you very much. You made my day! (and part of my work a lot easyer )

    greetings and kind regards,

    Fred

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: macro to add empty rows before and after specific rows

    Hi again Fred,

    Many thanks for your feedback - I'm always pleased to hear that I've made the computer do the work instead of the human!

    Best regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/absence
    By cmaunder in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2013, 04:50 PM
  2. Replies: 0
    Last Post: 10-23-2012, 04:59 PM
  3. Deleting rows with empty cells in a specific column
    By vzw1965 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-09-2011, 10:55 AM
  4. Deleting empty rows if specific cell in row is empty
    By csynic in forum Excel General
    Replies: 0
    Last Post: 07-06-2011, 01:43 AM
  5. Removing Empty Rows and selecting Specific Rows
    By Jetheat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-11-2005, 07:10 PM

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