+ Reply to Thread
Results 1 to 5 of 5

Macro for inserting specific rows with data when there is a change in the column

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Macro for inserting specific rows with data when there is a change in the column

    Hello there!

    This is my first post in this forum and I really hope someone can help me with my problem. I am a total newbie when it comes to macros but I sure like using them when it comes to data processing. I have two worksheets "dt_result" and "lookup". I have several columns of data in dt_result and I would need a macro that inserts rows 128:132 from "lookup" (this is the sheet where I store various lookup values and templates) every time there is a change in the value of the cell in column C in the dt_results sheet. I would need the macro to do this until the last used row in dt_result. I know how to insert blank rows but I can't figure this out. Any help would be appreciated.

    Julz

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro for inserting specific rows with data when there is a change in the column

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. Make sure the workbook demonstrates your desired results if possible, or just highlight the cells you're trying to fix. Use BEFORE/AFTER sheets if that helps make it clearer.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro for inserting specific rows with data when there is a change in the column

    Here is a copy of the workbook with the two worksheets I mentioned. A plus would be if the macro would also fill down the generated 5 row gap in columns C and G (in "dt_result") with the value just before the first blank cell. The background to all of this is that unlike all the chemical components, these five field parameters need to be typed in manually. The macro would help me minimize the effort of preparing the table for the manual data input. Thanks.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro for inserting specific rows with data when there is a change in the column

    Try running this with the source sheet onscreen, it will create a copy and reformat the data as you've described.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-06-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro for inserting specific rows with data when there is a change in the column

    Wow! It works perfectly! Thanks a bunch. It would be nice to understand all this.

+ 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