+ Reply to Thread
Results 1 to 6 of 6

Auto-fill to last column of data and then to last row of data

  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Auto-fill to last column of data and then to last row of data

    Hello to everyone,

    I would like to look for the last used cell in column 1, then grab L4 and auto-fill it up to the last used cell in column 1. Then auto-fill the range down to the last used row.

    In the attachment, AQ1 is the last used cell, so I would like to auto-fill L4 to AQ4. Then grab L4:AQ4 and auto-fill it down to row 41.

    Hopefully someone can help with the above as I've been struggling for a day editing other macros I've found online with no success.

    Thank you
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Auto-fill to last column of data and then to last row of data

    Try on a copy of your data
    Please Login or Register  to view this content.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  3. #3
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Auto-fill to last column of data and then to last row of data

    Hi WasWodge,

    The code works perfectly, thank you! I was wondering if you could help me with a slight issue I am having. In case I have other data below the MIN and MAX, the auto-fill moves after the MIN and MAX.

    Is it possible to also give a quick explanation of each line in the code as I'd really like to understand how it works?

    Thank you!
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Auto-fill to last column of data and then to last row of data

    See below

    Please Login or Register  to view this content.
    Or I suppose another option is to change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    But please note you will have to clear the contents each time before running.
    Last edited by WasWodge; 03-31-2013 at 08:14 AM. Reason: Colour

  5. #5
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Auto-fill to last column of data and then to last row of data

    Worked like a charm!
    Clearing the contents each time before running the code seems obvious but obviously I didn't think of it before you mentioned it! Thank you very much for the help and the explanation WasWodge. Really appreciated!

  6. #6
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Auto-fill to last column of data and then to last row of data

    Just to point out the clearing of data only applies if you are using the line below as it needs the empty spaces to work
    Please Login or Register  to view this content.
    If you are using something like the code below then it doesn't matter (unless you have less columns) as it doesn't need the empty spaces, because it looks for the last row with data and not the first row with data.
    Please Login or Register  to view this content.
    Last edited by WasWodge; 03-31-2013 at 08:03 PM. Reason: added a space

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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