+ Reply to Thread
Results 1 to 4 of 4

Auto fill Columns specified to and from (from a cell - i.e. dynamic)

  1. #1
    Registered User
    Join Date
    12-05-2012
    Location
    liverpool
    MS-Off Ver
    Excel 2007
    Posts
    67

    Auto fill Columns specified to and from (from a cell - i.e. dynamic)

    Hi,

    Hoping you can help.
    I need some simple code for being able to specify what column to copy and how far to copy it.
    I.e. if i want it to copy column d and auto fill to column z (but specify this in say cells A1 and A2 - so A1 has D in it and A2 has Z in it) what would be the code for this?

    Thanks,
    Tom.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Auto fill Columns specified to and from (from a cell - i.e. dynamic)

    Your example for autofill is not clear. To autofill, the range must include the cell with the value to enter into the fill range. So to fill Column A with the letter "d", assuming "d" is in A1 and you want to fill down to row 20.
    Please Login or Register  to view this content.
    If you are not sure how many rows are needed but you want it to be the same as column B data, then
    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    12-05-2012
    Location
    liverpool
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Auto fill Columns specified to and from (from a cell - i.e. dynamic)

    Thanks for your reply...

    Sorry i explained that really badly.

    So in this following code i want to make Columns("E:E") and Columns("E:L") dynamic:

    Please Login or Register  to view this content.
    So it would look something like this


    Please Login or Register  to view this content.
    So then in cell A1 I would type E and A2 I would type E. Then run the macro.....

    Obviously the code above doesn't work and there is probably a much simpler way to solve this.....

    I am looking to do this as i have numerous sheets that need to be extended the same range periodically but then get copied and pasted to and from different columns each time i do it...

    Apologies if still doesn't make sense....
    thanks
    Tom

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Auto fill Columns specified to and from (from a cell - i.e. dynamic)

    I don't believe you want the entire column to autofill all the way down to the last row on the sheet. That's over a million rows. You can determine the last row in your data set by
    Please Login or Register  to view this content.
    Then you can use that like
    Please Login or Register  to view this content.
    That would give you a range filled to the last row of the data set that existed at the time you run the macro.

+ 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. VBA Dynamic Range Auto-fill Series
    By fireboltpk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-30-2017, 08:40 AM
  2. Excel - Auto fill multiple columns based on cell Value
    By davidx100 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-20-2015, 12:43 PM
  3. How to Auto Fill base on a dynamic range
    By alexduy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2014, 03:04 PM
  4. Dynamic Auto Fill
    By staubach.6 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2014, 01:01 AM
  5. Dropping cell numbers in a formula as you auto-fill across columns
    By Nebs in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-23-2013, 12:48 AM
  6. Dynamic Auto Fill as part of a Macro
    By JacobStone in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2010, 07:41 PM
  7. Dynamic addline with Auto Fill
    By ITBATJB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2008, 07:51 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