+ Reply to Thread
Results 1 to 6 of 6

Paste data automatically into the next available column

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    Guildford
    MS-Off Ver
    Excel 2003
    Posts
    7

    Paste data automatically into the next available column

    I have three columns of data, and I have a macro which simply copy and pastes these three columns into another sheet. I want to repeat this process every month, and don't want the macro to paste over the old data, simply find the next column on the same sheet and paste it there.
    Is there a command that does this?

    Thanks! (This is my first post here, hi all!)

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

    Re: Paste data automatically into the next available column

    the last used column is
    endcol = Cells(1, Cells.Columns.Count).End(xlToLeft).Column
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Paste data automatically into the next available column

    Hi, Tishmimi,

    maybe this code may help.Please use it on a copy of your workbook and alter the names of the sheets where needed. I assumed that both sheets are in the same workbook. To me thereīs a big difference between finding the last row or column or the first free row or column thereafter:

    Please Login or Register  to view this content.
    Ciao,
    Holger

  4. #4
    Registered User
    Join Date
    08-22-2012
    Location
    Guildford
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Paste data automatically into the next available column

    Hi Holger, that has done what I asked for, so thank you.

    But there are a couple of extra things. For example, one of the columns of data are in the percentage format, so I need that to copy over as a percentage.
    Secondly, I had already figured this out so hadn't needed to ask, but with this format I need to rethink it. I want the current date (at the time of the macro being run) to be imprinted with the data, ideally at the top of the three columns of data.

    Any ideas?
    Thanks

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Paste data automatically into the next available column

    Hi, Tishmimi,

    assume itīs the second column of the 3 columns to copy:

    Please Login or Register  to view this content.
    Ciao,
    Holger

    Don't forget to mark thread as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [ code ] Your code here [ /code ] (without the spaces inside the brackets)

  6. #6
    Registered User
    Join Date
    08-22-2012
    Location
    Guildford
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Paste data automatically into the next available column

    Thanks, that has worked - although it was the third column that needed the percentage, I was able to change the line to .Cells(1, lngFreeCol + 2) instead of +1

    Cheers!

+ 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