+ Reply to Thread
Results 1 to 7 of 7

Macro to add data to 'next available column' in excel

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    7

    Smile Macro to add data to 'next available column' in excel

    Hi,

    I think this is really simple to do but basically I would like to be able to create a macro where I can copy a set of cells from a worksheet and paste them in the next available column from the start of the worksheet.

    So If column A already has data in it, the macro will see this and paste the copied cells into column B - going as far down in terms of rows as the number of cells copied.

    I also then need to do this where it copies from one worksheet and pastes into another - but does exactly the same thing as above.

    Any help would be greatly appreciated.

    Thanks in advance for your help!

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to add data to 'next available column' in excel

    hi, perera2112, please check attachment, some options to make it, run code "test"
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-16-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to add data to 'next available column' in excel

    Quote Originally Posted by watersev View Post
    hi, perera2112, please check attachment, some options to make it, run code "test"
    Hi.

    Thanks for this. I can see that this works - but am struggling to apply it to the automated macro which I have at the moment:

    Please Login or Register  to view this content.
    Everytime it does a 'paste-special' above - the macro should paste special to the next available cell going horizontally to the right. Thats the complicated bit.
    Last edited by perera3112; 05-17-2011 at 06:33 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro to add data to 'next available column' in excel

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to add data to 'next available column' in excel

    Let's asume cells A1, B1, C1 hold some values, then this

    Please Login or Register  to view this content.
    will select next empty cell D1

  6. #6
    Registered User
    Join Date
    05-16-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to add data to 'next available column' in excel

    Excellent. Thanks very much for this!

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to add data to 'next available column' in excel

    if you are satisified with the offered help and there are no more outstanding issues regarding this thread, please mark the thread as solved (see Forum Rules on "How to" questions)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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