+ 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 2007,2010,365
    Posts
    44,347

    Re: Autofill cells X amount of columns to the right

    Untested, but try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    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 2007,2010,365
    Posts
    44,347

    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 2007,2010,365
    Posts
    44,347

    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 2007,2010,365
    Posts
    44,347

    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)

Similar Threads

  1. How to autofill X amount of columns based on whatever numeric value X is
    By jamesproudlock1993 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 04-09-2019, 09:49 AM
  2. [SOLVED] Macro to autofill cells and delete some rows and columns
    By k.m. in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2015, 06:09 PM
  3. [SOLVED] Autofill columns with data from first 3 cells
    By coach.32 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-20-2015, 12:14 AM
  4. autofill multiple columns and visible cells only
    By njan1982 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2013, 11:28 PM
  5. Autofill to the right for variable amount of columns
    By sideshow1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2013, 05:31 PM
  6. Making an known amount of replicates in autofill
    By Reas in forum Excel General
    Replies: 3
    Last Post: 08-28-2012, 06:00 AM
  7. Replies: 5
    Last Post: 09-30-2010, 08:02 PM

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