+ Reply to Thread
Results 1 to 9 of 9

Runtime Error "1004" Autofill Method of range class failed

  1. #1
    Registered User
    Join Date
    12-14-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Runtime Error

    i get a run time error when compiling a code and it points to this code below. Basically i need it to will only run it if you have 3 or more lines filled out on the form. if you have 2 it won't. Any help as to what could be done to change it so it can read 1 or 2 lines also.



    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Runtime Error

    Maybe something like:
    Please Login or Register  to view this content.
    I couldn't see your "with" stuff, so left it out.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-14-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Runtime Error "1004" Autofill Method of range class failed

    new to VBA. I had posted but did not include the full code sorry bout that. Any help will be highly appreciated. The highlited part is where vb tells me the error is. So what this is that if there are less than 3 lines on the excel sheet being filled out it won't comply unless its 3 lines. How can i change it to take 1 or 2 lines also instead of only 3 or more. I have lots of this lines like this so i have to change them also.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Runtime Error "1004" Autofill Method of range class failed

    Can you back up a step and explain what you're trying to do?
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Runtime Error "1004" Autofill Method of range class failed

    DonKarlos, I have merged your two threads to keep confusion to a minimum. Please don't post more than one thread about the same topic from now on.

    cheers

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Runtime Error "1004" Autofill Method of range class failed

    Try putting the "." back in the Destination parameter as well.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Runtime Error "1004" Autofill Method of range class failed

    A couple of ideas:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-14-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Runtime Error "1004" Autofill Method of range class failed

    Thank you for the help. I think your code worked thoough it gives me an error saying "compile error End If without block IF". when i take the End IF satement out, it runs fine but then goes to another segment in the code saying "Compile error Label Not Defined". Any idea why?


    Quote Originally Posted by JBeaucaire View Post
    A couple of ideas:
    Please Login or Register  to view this content.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Runtime Error "1004" Autofill Method of range class failed

    The error wasn't the END IF, it was the "_" at the top of that section. Use this:
    Please Login or Register  to view this content.

+ 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