+ Reply to Thread
Results 1 to 4 of 4

Getting error 1004

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Getting error 1004

    Hi friends,
    I’m getting error 1004 if there is no value in column ‘N’. The piece of code is as follows:

    With Range("m7")
            .Value = "1"
            .AutoFill .Resize(Range("N" & Rows.Count).End(xlUp).Row - .Row + 1), 2
        End With
    If column ‘N’ is blank then there should not be 1 in column ‘M’ and the macro should exit sub and continue because I have called another macro at the end of this macro. The series of macros should not be stopped, it should continue till the last called macro without any problem.

    Any help will be appreciated.

    Thanking you,
    Sincerely,

    mso3

  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,259

    Re: Getting error 1004

    Hello mso3,

    You need to check that the row in column "N" is not less than 7 before you do the AutoFill.

    Try this...
        Dim LR As Long
        
        With Range("m7")
            LR = Range("N" & Rows.Count).End(xlUp).Row
            If LR >= .Row Then
                .Value = "1"
                .AutoFill .Resize(LR - .Row + 1), 2
            Else
                MsgBox "Column N is Empty."
            End If
        End With
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Getting error 1004

    Hi Leith Ross,
    Thank you. It's working fine.

  4. #4
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Getting error 1004

    What happens if you try to manually autofill a series starting from a blank cell?
    http://msdn.microsoft.com/en-us/libr...ffice.15).aspx


    Sent from my iPad using Tapatalk

+ 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. Runtime error '1004': Paste special method of range class error.
    By Daryl Zer0 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-05-2014, 01:44 AM
  2. [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
  3. [SOLVED] Getting Error 1004 Object or Application Defined Error - Code to rearrange data
    By BlazzedTroll in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-10-2013, 12:10 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM

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