+ Reply to Thread
Results 1 to 6 of 6

Runtime error 1004 in VBA with AutoFill

  1. #1
    Registered User
    Join Date
    03-18-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    4

    Runtime error 1004 in VBA with AutoFill

    Hi,

    This is actually my first post to the forums, also pretty much making my first cuts in VBA so bear with me please

    Using Excel 2010;

    I'm editing two worksheets in a multisheet workbook, transfering data from "Sheet2" to "Sheet1" using copy-paste.
    I have an unknown amount of data in a list with headers in columns A-J in Sheet2, which I will need to copypaste to Sheet1.

    I will then add formulas to columns H and J, starting from row 4, the first row below headers. I will then need to autofill the formulas to the last row.

    Amount of rows can be different everytime and can change between 1-221 at the moment.

    I get Runtime error 1004 at lines with autofill. Otherwise code runs fine. RT error is my major obstacle, but I don't mind suggestions about optimising code as I'm a new hand in VBA

    Please Login or Register  to view this content.
    Help much appreciated!

    Br, Arkki

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Runtime error 1004 in VBA with AutoFill

    Does this work for the first AutoFill?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-18-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Runtime error 1004 in VBA with AutoFill

    Quote Originally Posted by Norie View Post
    Does this work for the first AutoFill?
    Please Login or Register  to view this content.
    Hi,

    for some reason it does not enter the formula at all.

  4. #4
    Registered User
    Join Date
    03-18-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Runtime error 1004 in VBA with AutoFill

    In reference to previous post by Norie, the problem is not entering the formula to the range. The issue is that it should autofilled only to the last row with data.

    That last row is usually row 220, but can be anything between row 4-220. End users don't want the autofill by default to whole max range.

    Right now the code works fine otherwise. But users dont want to fill down the formula by themselves, it should come from the macro.

    Many thanks,

    Arkki

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Runtime error 1004 in VBA with AutoFill

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  6. #6
    Registered User
    Join Date
    03-18-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Runtime error 1004 in VBA with AutoFill

    Hi here's the sample workbook, code is stored in ThisWorkBook.

    Br,

    Arkki
    Attached Files Attached Files

+ 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] 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
  2. [SOLVED] Range error in code, runs alone but not inside my full program, giving runtime error 1004
    By charizzardd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:34 PM
  3. Runtime Error "1004" Autofill Method of range class failed
    By DonKarlos in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-15-2009, 07:44 PM
  4. [SOLVED] What causes runtime error 1004?
    By [email protected] in forum Excel General
    Replies: 4
    Last Post: 10-27-2005, 03:05 PM
  5. Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 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