+ Reply to Thread
Results 1 to 6 of 6

Macro to copy data from previous column into next free column

  1. #1
    Registered User
    Join Date
    08-20-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    3

    Macro to copy data from previous column into next free column

    Hi All,

    I have a spreadsheet which is updated daily. Row A of the sheet has the date in it, and every day a new column is created for the that set of data. I have the below code which works at the moment:

    Please Login or Register  to view this content.
    I want to use this same code on another spreadsheet to do the same process (I need to copy and paste 4 columns (A,B,C + D, into E, F, G & H, then tomorrow it will copy E, F, G & H into I, J, K &L etc etc)). The problem I'm having is that A1:C1 is a merged cell, then D isn't (used as a border to separate). So when it is copied I need to select the merged cell columns and column D (i.e. A:C & D on day 1) and paste it into E:H with E1:G1 merged.

    Is there a way to adjust the above code to account for this?


    Thanks!

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to copy data from previous column into next free column

    Yes, Unmerge the cell in question and then set the merge backup again (Merged are the bane of XL existance, IMHO)....anyway, it get the code - record macro of you unmerging the cell and re-merging- this should give you the code....HTH
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to copy data from previous column into next free column

    did this help?

  4. #4
    Registered User
    Join Date
    08-20-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    3

    Re: Macro to copy data from previous column into next free column

    Sorry, just got round to looking at this again.

    Ok, so I can unmerge the cells easily enough, but how do I amend this code to copy the last four columns and past it into the next available 4 columns? My trial and error has failed :/

    Please Login or Register  to view this content.

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to copy data from previous column into next free column

    sorry, I didn't understand that part....I thought you had that part done but the merge cells was messing with you.....give me a minute or so....

  6. #6
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to copy data from previous column into next free column

    this is very crumsy but it seems to work and may just get you started

    Please Login or Register  to view this content.

+ 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. Macro to enter data in next column if previous column is filled.
    By NIKNIKNIK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2014, 11:26 AM
  2. [SOLVED] Macro to Concatenate, copy and paste the formula until the last row of the previous column
    By venkat.ramamoordhy1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2013, 04:03 PM
  3. [SOLVED] Macro to Copy Formating from Previous Column and Paste into Last Column
    By rmmohan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-05-2013, 09:37 AM
  4. Insert column and fill column upto where data is in previous column
    By aka189 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-24-2012, 06:07 AM
  5. Macro to copy data from previous column according to criteria.
    By Folshot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2011, 08:20 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