+ Reply to Thread
Results 1 to 3 of 3

AutoFill Error 1004

  1. #1
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    AutoFill Error 1004

    Hi Excel Forum,

    Me again

    This is probably really simple but it has blown my mind and I know why it is failing but I just don't know how to fix it

    I have a sheet that extracts data from another sheet after criteria has been met. It is then copied onto another sheet, allocated to a colleague via a autofill and then pasted back into the masterfile.

    The issue I am facing is that the data changes all the time as the results from the criteria can return different rows of data so the allocation autofill fails as I may have more colleagues than data to autofill

    The example I have added you will see two lines of data on the magic tab, on the staff tab I have two colleagues so when the staff data is pasted over it fails with a Run Time error 1004 and am assuming that it has nowhere to autofill to. There could be times where I have 30 lines of data on the magic tab and the macro works perfectly well, but there could be a time when I have only one line of data and it will fail again.

    This is where I am stuck as I don't know how to fix it?

    Any help would be greatly appreciated as I am dumbfounded
    Attached Files Attached Files
    Last edited by davesexcel; 02-26-2022 at 08:52 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Autofilter Error 1004

    It looks like you need to count the rows in column X after you paste not before.

    The error you get is when the rows count for Column B is not greater than the rows count for column X,
    so autofill only if B row count is greater than X row count.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: AutoFill Error 1004

    And there I thought I dumbfounded the forum

    Easy when you know how.

    I did eventually get it working with a If Statement but it was pretty convoluted whereas your example above davesexcel rippled out the the bumph I added. Many thanks. Feel a bit of a wally for not thinking of re-counting column B.

    I tweaked it to do what I wanted it to do so if anybody in the future would like something similar without all the hardwork. Here you go..

    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)

Similar Threads

  1. [SOLVED] Macro Error on Filtering – “Run-time error ‘1004’ Autofilter method of range class failed
    By kschmit1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2019, 11:49 AM
  2. VBA Autofilter method error (runtime error 1004)
    By Jchula in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2015, 02:37 PM
  3. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  4. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 PM
  5. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 PM
  6. [SOLVED] Runtime error 1004? - Autofilter
    By 13lack13lade in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2013, 12:48 AM
  7. PivotTable Autofilter -- RunTime Error 1004
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-11-2013, 11:22 AM

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