+ Reply to Thread
Results 1 to 12 of 12

How can I append data to the end of a column with a macro

  1. #1
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    How can I append data to the end of a column with a macro

    Hi,

    I have a spreadsheet with booking data that we are analysing for missed opportunities. We've got most of the analytics done but it requires a lot of data movement to get it to work that I'm trying to automate.

    I've managed to do most of it with Recorded Macro's (I know they aren't the neatest way of doing things but I'm not a programmer so it's the best I can do)

    What I can't work out is how to copy data from one column and append it to another. Can anyone help please?

    Regards,

    Paul

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How can I append data to the end of a column with a macro

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How can I append data to the end of a column with a macro

    How do I specify which column to copy and where to paste?

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How can I append data to the end of a column with a macro

    Please Login or Register  to view this content.
    in this code A is column to copy, B is column to paste

  5. #5
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How can I append data to the end of a column with a macro

    Hi, Thank you for your quick response. Works perfectly.

    Regards,

    Paul

  6. #6
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How can I append data to the end of a column with a macro

    Hi Patel45,

    I've used the following code adapted from your post and it works perfectly thanks.
    HomeSite = Cells(Rows.Count, "F").End(xlUp).Row
    HomeSiteDest = Cells(Rows.Count, "U").End(xlUp).Row + 1
    Range("F2:F" & HomeSite).Copy Range("U" & HomeSiteDest)

    You may be able to help me with my next part. Is there a way of writing "-1" in the column next to where I've pasted these values (Column W)?

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How can I append data to the end of a column with a macro

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How can I append data to the end of a column with a macro

    Thanks Again Patel45. I'm almost there. I need to repeat the process to copy another column and then have +1 in the same Column as the -1..

    I'm running this as my code;
    Sub CombineData()

    HomeSite = Cells(Rows.Count, "F").End(xlUp).Row
    HomeSiteDest = Cells(Rows.Count, "U").End(xlUp).Row + 1
    Range("F2:F" & HomeSite).Copy Range("U" & HomeSiteDest)


    SendDate = Cells(Rows.Count, "G").End(xlUp).Row
    SendDateDest = Cells(Rows.Count, "V").End(xlUp).Row + 1
    Range("G2:G" & SendDate).Copy Range("V" & SendDateDest)

    Range("W2:W" & HomeSite).Value = "-1"

    ReturnDate = Cells(Rows.Count, "H").End(xlUp).Row
    ReturnDateDest = Cells(Rows.Count, "V").End(xlUp).Row + 1
    Range("H2:H" & ReturnDate).Copy Range("V" & ReturnDateDest)


    HomeSite = Cells(Rows.Count, "F").End(xlUp).Row
    HomeSiteDest = Cells(Rows.Count, "U").End(xlUp).Row + 1
    Range("F2:F" & HomeSite).Copy Range("U" & HomeSiteDest)


    Range("W2:W" & ReturnDate).Value = -1

    The problem I'm having is that the second pass overwrites the first instead of appending to the end.

    Regards,

    Paul

  9. #9
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How can I append data to the end of a column with a macro

    Attach please a sample file for testing

  10. #10
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How can I append data to the end of a column with a macro

    Master template#3 (2).zip

    Thanks for your help in on this Patel. Good people are hard to find.

    Regards,

    Paul

  11. #11
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How can I append data to the end of a column with a macro

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-22-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How can I append data to the end of a column with a macro

    Works perfectly. Thank you so much

+ 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] Macro to append data
    By garethmckeever74 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-23-2013, 05:35 AM
  2. Looping through worksheet and append data from one column to another
    By dgulliver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2012, 08:40 AM
  3. multiple columns data append in single column
    By suresh3566 in forum Excel General
    Replies: 3
    Last Post: 06-11-2011, 07:52 AM
  4. Append data from a column to separate table array
    By miss_q in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2005, 07:01 PM
  5. Replies: 4
    Last Post: 11-16-2005, 06:10 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