+ Reply to Thread
Results 1 to 5 of 5

AutoFill error

  1. #1
    Registered User
    Join Date
    09-16-2008
    Location
    Bellingham, WA
    Posts
    3

    AutoFill error

    Hi,

    I have been getting a "Run-time error '1004': AutoFill method of Range class failed" on a macro. There only seems to be problems when I assign the macro to a button. When I run the macro directly everything works fine.

    Here's the bit of code in question:
    Please Login or Register  to view this content.
    It fails at line 6 where it first tries to autofill. I know that the code could be simplified, this is how Excel gave it to me when I recorded it. I have tried changing .Select to .Activate and I have tried getting rid of .Select and Selection. by merging Range and Autofill and I tried adding Sheets("Data"). before all the Range lines.

    I'm new at VBA and this is pretty frustrating since it worked before I assigned to a button, so any help would be greatly appreciated.

    Thanks,
    Mark

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Mark,

    Welcome to the Forum!

    I revised your macro. You can attach this macro to a button or run it directly.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    09-16-2008
    Location
    Bellingham, WA
    Posts
    3
    Thanks for the help Leith. I pasted you code into mine with the same result. I was assuming the problem lie with the portion of the code that isn't working. Now I'm not so sure so here is code in its entirety.

    I have 2 primary sheets that create copies of a template. The template is full of drop-down menus positioned over cells with formulas to show what was chosen. All the data for the drop-down menus are kept on a hidden sheet "Data". When the user finishes filling out the "Template" sheet by selecting values from the drop-down menus, the user will click a button on the sheet. The button should copy the template to a new sheet, erase all cells and buttons and menus, copy just the data from the template over, rename the new sheet, reset the data in the "Data" sheet, and save the file.

    Please Login or Register  to view this content.
    Again, thanks for the help,

    Mark Bottorff

  4. #4
    Registered User
    Join Date
    09-16-2008
    Location
    Bellingham, WA
    Posts
    3

    Auto fill error

    Bump to the top.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Mark,

    Would you post your workbook so I can review it?

    Sincerely,
    Leith Ross

+ 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. Compile error: Object required
    By Hinnerk in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-23-2012, 04:38 PM
  2. Autofill error. Quick fix needed.
    By richardeallen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2008, 10:38 AM
  3. Trying to autofill to end and getting run time error
    By ugg in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-29-2007, 10:21 PM
  4. Pausing code on Error then resuming once resolved
    By dp_galea in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2007, 05:08 PM
  5. Error Handling using Getdata
    By Climbo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-30-2007, 08:41 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