+ Reply to Thread
Results 1 to 5 of 5

Cut/Paste to Empty Column Macro

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

    Cut/Paste to Empty Column Macro

    Hello,

    I would really appreciate some help as I am not that well versed in VBA. What I'm trying to accomplish is the following:

    a) Row 1, Col B thru M have months listed (Jan - Dec).
    b) Col A starting from Row 2 goes down in this order: Q1,Q2, Q3, Q4, Q1, Q2, Q3, Q4....keeps repeating.
    c) Each Q1-Q4 for the first 4 rows have the same #s (i.e., 200, 200, 200, 200). The second set of Q1-Q4 has a different set of #s (i.e., 500, 500, 500, 500). And this goes on down to hundreds of rows.

    SAMPLE
    1 A Jan Feb Mar Apr May...
    2 Q1 200 200 200 200
    3 Q2 200 200 200 200
    4 Q3 200 200 200 200
    5 Q4 200 200 200 200
    6 Q1 500 500 500 500
    7 Q2 500 500 500 500
    8 Q3 500 500 500 500
    9 Q4 500 500 500 500

    What i need to do is:

    1. Take Row2 Col B,C,D and cut/paste to Row1 Col E,F,G.
    2. Do the same for Rows 3 & 4, but paste into Col H,I,J & K,L,M respectively.
    3. Delete Rows 2-4.
    4. Repeat Steps 1-3, however, this time the cut and paste will start from Row 4.

    I need to do this until all the #'s have been cut/paste from Jan - Dec.

    Any help would be greatly appreciated and thank you in advance.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Cut/Paste to Empty Column Macro

    Hi xclnewb, welcome to the forum.

    Perhaps the following macro will work for you:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Cut/Paste to Empty Column Macro

    One line less, changed step value from -1 to -4, so we don't have to decrement "i" within the loop.
    Please Login or Register  to view this content.

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

    Re: Cut/Paste to Empty Column Macro

    This is what I needed and worked perfectly. Thank you for the quick solution!

    Btw, which VBA book would you recommend for a newbie like myself? It'll probably take some time to get to your level, but am determined to learn as much as I can and hopefully one day be able to assist others. Again, thanks for the quick reply.

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Cut/Paste to Empty Column Macro

    There are several threads in this forum asking the same question. Here's one:

    http://www.excelforum.com/the-water-...ok-on-vba.html

    It lists a few, and in post 4 Roy provides a link to our General forum, in which the first two threads are "Sticky" and contains many, many links for Excel resources.

    http://www.excelforum.com/excel-general/

+ 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