+ Reply to Thread
Results 1 to 5 of 5

Trouble creating macro for one blank row above with copy paste data

  1. #1
    Registered User
    Join Date
    03-21-2011
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Trouble creating macro for one blank row above with copy paste data

    Hello

    I'm experienced in Excel, but novice in VBA. The task I have in front of me is that I have a very large spreadsheet (28,000 +rows) that has data that was exported from a legacy system that we no longer have. It has data in columns A thru G. I must get this data prepped to have ready for importation into the new system. What I'm trying to do is copy the data in cell A and cell B, everytime the value in column D = 1, and insert one blank row above and copy the values from cell A and cell B to cell A and cell B on the newly created row.

    Below is a picture of what I'm trying to capture:

    sample image.png

    I thought that a macro would be a fairly easy way to do this, but it's proven challenging for me to write. Here is what I attempted using the macro recorder:

    Please Login or Register  to view this content.
    Any and all help will be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: Trouble creating macro for one blank row above with copy paste data

    Please Login or Register  to view this content.
    Have a look here.

    http://www.excelforum.com/excel-prog...very-slow.html

  3. #3
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Trouble creating macro for one blank row above with copy paste data

    try the following macro:
    Please Login or Register  to view this content.
    Make sure the AUTOFILTER in not already ON in your table.
    Last edited by p24leclerc; 04-25-2014 at 07:00 PM.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  4. #4
    Registered User
    Join Date
    03-21-2011
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Trouble creating macro for one blank row above with copy paste data

    jolivanes and p24leclerc thank you for responding. both of your solutions worked brilliantly! i greatly appreciate the prompt response!

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: Trouble creating macro for one blank row above with copy paste data

    I assume you noticed that the code in post #2 works on cell change and not on the numbers in Column D.

    Good luck

+ 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. Help with creating a macro that will copy and paste data to multiple sheets.
    By harkin123 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-19-2013, 06:57 AM
  2. Creating Macro to Copy & Paste without overwritting
    By ime0504 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 11:25 AM
  3. Need help in creating a macro to copy and paste to Notepad
    By corp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2012, 12:20 AM
  4. Trouble formatting Row Height while using a Copy/Paste Macro
    By MK@Hartford in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2005, 12:50 PM
  5. Run Macro & Rename Sheet upon creating copy from blank.
    By Kervin Manasseh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2005, 07:05 AM

Tags for this Thread

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