+ Reply to Thread
Results 1 to 8 of 8

Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsheet

  1. #1
    Registered User
    Join Date
    07-31-2014
    Location
    chicago
    MS-Off Ver
    2010
    Posts
    6

    Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsheet

    Hi All,

    Im a bit of a n00b with these Macros and have been trying to modify some VBA code I used for a different but similar task without success. What I want to do is ensure that there are no blank cells in the the first 2 columns of my spreadsheet.

    The data is stored like this

    AA : 12 : 34 : 45
    : : : 46
    : : : 47
    BB : 23 : 34 : 48
    : : : 49
    CC : 45 : 34 : 50
    DD: 67 : 34 : 51
    : : : 52
    : : :53
    EE: 91 : 34 :54

    And id like the Macro to run through the sheet a copy columns 1 and 2 and paste them into proceeding rows until they hit the next set of data, then copy those cells and paste until they hit the next and so on, so the sheet looks like this

    AA : 12 : 34 : 45
    AA : 12 : : 46
    AA : 12 : : 47
    BB : 23 : 34 : 48
    BB : 23 : : 49
    CC : 45 : 34: 50
    DD: 67 : 34 : 51
    DD: 67 : : 52
    DD: 67: :53
    EE: 91 : :54

    Sorry for the shitty drawing but let me know if you have any ideas. This is what I tried to no avail

    Please Login or Register  to view this content.
    Last edited by slk1186; 08-07-2014 at 12:06 PM. Reason: solved

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    http://www.contextures.com/xlDataEntry02.html

    This has exactly what you need.

    You dont need VBA to do this btw.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    Hi slk1186

    Welcome to the Forum!!

    Please fix your Code Tags...you're missing the leading forward slash in the closing [/CODE].

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" worksheet that demonstrates what you wish the output to be.

    To Attach a File:

    1. Click on Go Advanced
    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 "Add Files"... button to locate your file for uploading.
    6. This will open a new window File Upload...Click "Select Files"
    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 Files" button and wait until the file has uploaded.
    10. Click the "Done" Button.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    07-31-2014
    Location
    chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    Thanks mikeTRON,

    This works almost exactly as I needed, can you recommend how i might alter the code below(from your link above) to have it copy not just the first column but also the second?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    Why are you using VBA instead of find Blanks =cellabove? then copy paste values?

  6. #6
    Registered User
    Join Date
    07-31-2014
    Location
    chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    Just trying to learn a bit about how to manipulate the code

  7. #7
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    I would read this.
    http://www.cpearson.com/excel/DebuggingVBA.aspx

    It will help you walk through the code.

  8. #8
    Registered User
    Join Date
    07-31-2014
    Location
    chicago
    MS-Off Ver
    2010
    Posts
    6

    Re: Need VBA Macro to Copy and paste column data in blank rows and repeat through spreadsh

    Thanks, go Mavs!

+ 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] Copy data and paste in first blank row of Column A
    By Hood in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-08-2014, 08:48 AM
  2. How to create a macro to insert blank rows and copy data into blank rows?
    By zodiack101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2013, 01:18 PM
  3. [SOLVED] Macro to copy columns and paste into one column in next blank column
    By rmmohan in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-31-2013, 03:14 PM
  4. [SOLVED] copy everything from column B to end of data, paste to summary, repeat for next worksheet
    By fabrecass in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-12-2013, 07:43 AM
  5. Macro - Copy/Paste certain cells and move down column and repeat
    By rohan87 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-16-2013, 02:02 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