+ Reply to Thread
Results 1 to 7 of 7

Autofill cells X amount of columns to the right

  1. #1
    Registered User
    Join Date
    06-06-2019
    Location
    Colorado
    MS-Off Ver
    WIndows7
    Posts
    3

    Autofill cells X amount of columns to the right

    Hi,

    I am trying to write a code that copies an active cell 12 columns out, without specifying the 12th column.

    Capture.PNG

    The highlighted rows are an example of what I am looking for.
    I was thinking of doing something like:

    For Each cell in Range("M:Z")
    **somehow auto-fill each cell containing a value in the range to 12 cells to the right.

    Anything is helpful thank you!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    29,632

    Re: Autofill cells X amount of columns to the right

    Untested, but try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-06-2019
    Location
    Colorado
    MS-Off Ver
    WIndows7
    Posts
    3

    Re: Autofill cells X amount of columns to the right

    Thank you, I keep getting an error message on the second line.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    29,632

    Re: Autofill cells X amount of columns to the right

    oops:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    29,632

    Re: Autofill cells X amount of columns to the right

    Or, with multiple contiguous cells in the same column:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-06-2019
    Location
    Colorado
    MS-Off Ver
    WIndows7
    Posts
    3

    Re: Autofill cells X amount of columns to the right

    Thank you this was very helpful! I am having trouble applying this to the first cell in each row in the range M:X. Do you have an idea of how I can do this so it will look like the rows I highlighted in the first image, but for every first cell within each row?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    29,632

    Re: Autofill cells X amount of columns to the right

    You said
    I am trying to write a code that copies an active cell 12 columns out, without specifying the 12th column.
    and that's what the code I provided does.

    I'm not sure what you are asking for now. You only highlighted a couple of rows ... and you refer to an "active cell" which implies that you have selected a cell before running the macro.

    Given that you have start and end dates, why donít you just use a formula?

+ 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