+ Reply to Thread
Results 1 to 9 of 9

Autofill Until is Empty

  1. #1
    Registered User
    Join Date
    11-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Autofill Until is Empty

    Help!!

    Here is my code

    Please Login or Register  to view this content.
    What is meant to happen is that Column E is autofilled until column A is empty! However this is not working column E is Autofilling until the end of the sheet.

    Any help with where I went wrong in my code? PS column A will have a dynamic list, that is each time it could have 1 or 100 rows depending thats why I need E to autofill until A is blank.

    Thank you
    Last edited by Dnass; 11-22-2013 at 01:54 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Autofill Until is Empty

    Try this…

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Autofill Until is Empty

    Hi, Dnass,

    use Option Explicit at the top of the prodecure, you created a new Variable with lastrow& instead fo using the filled lastrow.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    11-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Autofill Until is Empty

    Sixthsense this worked perfectly thank you!

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Autofill Until is Empty

    Glad it helps you and thanks for the feedback

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Autofill Until is Empty

    Hi, Dnass,

    this worked perfectly
    Not according to your original code where the code should look like
    Please Login or Register  to view this content.
    as the code provided will Autofill in any case.

    Holger

  7. #7
    Registered User
    Join Date
    11-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Autofill Until is Empty

    Hi Holger,
    You're right, this did not work perfectly unfortunantely
    I have run across more trouble. Without having to build several macros and have them called for each step I have the following macro. Basically Columns E, F, G H and I will all be autofilled (with different inputs) the autofill should autofill until column A is empty for all. The below code works fine if I have data that goes past cell A2 as soon as I have data that finishes at A2 the macro errors with '1004 instead of exiting the sub.
    Please Login or Register  to view this content.
    Any suggestions?

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Autofill Until is Empty

    Hi, Dnass,

    maybe you should have another look at my posts in this thread for finding out what was changed in order to make the code work without error. You used the very same new Variable as in the opening post - why? The code by Sixthsense works with a With-Statement but neglects the Autofill range to be related to that worksheet.

    Regarding your question: put in another if to check if the value of the Variable holding the last filled row in Column A is greater 2 (I choose <=2 here).

    Please Login or Register  to view this content.
    This code will check each single column before filling.

    You may combine this to read
    Please Login or Register  to view this content.
    HTH,
    Holger

  9. #9
    Registered User
    Join Date
    11-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Autofill Until is Empty

    Holger - excuse me if I had previously seemed ignorant my VBA skills are very very basic and my knowledge is self taught through forums such as this. Your help has been appreciated!! The above code has worked and I have learnt something new! thank you

+ 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. [SOLVED] autofill until adjacent cell empty
    By Hassan1977 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-03-2013, 01:54 PM
  2. [SOLVED] How to autofill any formula till last empty cell
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2013, 08:56 AM
  3. Macro for Autofill removes header info when there is no data to autofill
    By esturan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2012, 01:42 PM
  4. AutoFill Above in empty cells
    By excelgrrl in forum Excel General
    Replies: 3
    Last Post: 12-15-2009, 06:40 PM
  5. Macro to autofill a number in empty cells in a column
    By excelaspire0219 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-29-2009, 12:03 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