+ Reply to Thread
Results 1 to 4 of 4

Paste to next 10 columns

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Paste to next 10 columns

    Hi all, I have the below macro which basically finds the last row in column AJ (35) and then copies that cell and pastes it into all the rows above (offset by 1 - so pastes from row 2 down). What I want to do is not only paste to that current column, but also the 10 columns to the right but I am really struggling to amend the code accordingly. I imagine this will be fairly straight forward and simple but I can't get my head around it.

    Any assistance much appreciated

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,224

    Re: Paste to next 10 columns

    Quote Originally Posted by cmb80 View Post
    Hi all, I have the below macro which basically finds the last row in column AJ (35)
    No, this macro searches for the last non-empty cell in column A. If you were actually searching for column AJ, you should write:
    Please Login or Register  to view this content.
    Try:
    Please Login or Register  to view this content.
    Artik

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Paste to next 10 columns

    as for the first part:
    Please Login or Register  to view this content.
    sequence is: start in the bottom-left corner of the sheet, move right 35 (to column 36th column - AJ). Move up till the first not-empty cell is found. While the original sequence was:
    start in the bottom-left corner of the sheet, Move up till the first not-empty cell is found (you are still in column A).Move right 35 (to column 36th column - AJ) - but it's not necessary the last filled cell in this column.
    Of course you can do this as Artik suggested starting immediatelly at the bottom of column AJ:
    Please Login or Register  to view this content.
    As for the copying this cell, (say it's AJ100) I understand that you want to copy it to range AJ2:AJ99 (from the 2nd row to current row -1) and into next 10 columns so also to AK2:AT99.

    If that's the case try:
    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    .
    Best Regards,

    Kaper

  4. #4
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Paste to next 10 columns

    Or directly
    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. Replies: 2
    Last Post: 05-21-2020, 03:27 AM
  2. loop through files find columns and copy/paste them as columns in master workbook
    By Michal1111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2018, 10:40 PM
  3. [SOLVED] Conditional Paste - Only paste in columns that meet criteria.
    By chris01252 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2015, 02:33 PM
  4. Macro to Copy from 2 Columns, Paste Value in the next 2 Columns, Then clear 1st Columns
    By MHALTTUNEN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2014, 03:34 PM
  5. macro to add columns after existing columns and copy/paste headers and formulas
    By rhybeka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 02:35 PM
  6. [SOLVED] create workbook and paste data and cut paste columns
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2012, 04:22 AM
  7. Replies: 2
    Last Post: 02-22-2011, 02:07 AM

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