+ Reply to Thread
Results 1 to 7 of 7

Runtime error 1004 - help needed!

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2013
    Posts
    16

    Runtime error 1004 - help needed!

    Hi,

    I have the following macro, which is suppose to copy a row that is set to "VERIFIED" to the archive worksheet.
    The code is in "Module 1" the sheet where it has to copy from has name "WBO INFO" and the sheet where it needs to copy to "Archives" and clear that row (actually delete that row would be better if possible)
    Number of columns are 15 and "VERIFIED" is on column "O"

    So I select the cell with value "VERIFIED" in "WBO INFO" sheet and run macro and I get error "Runtime error 1004: Application-defined or object-defined error". on lines:

    Destination:=Worksheets("Archives").Cells(1, 1).End(xlDown).Offset(1, 0)
    ActiveCell.Offset(0, -14).Range("A1:O1).ClearContents


    Complete code:

    Sub Archive()

    If ActiveCell.Value = "VERIFIED" Then
    ActiveCell.Offset(0, -14).Range("A1:O1").Copy _
    Destination:=Worksheets("Archives").Cells(1, 1).End(xlDown).Offset(1, 0)
    ActiveCell.Offset(0, -14).Range("A1:O1).ClearContents
    End If
    End Sub

    Thanks,

    i||uSi0n^

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Runtime error 1004 - help needed!

    1. Please use code tags.
    2. Better to use xlUp rather than xlDown:
    Please Login or Register  to view this content.
    Otherwise, if A2 is blank, your xlDown takes you to the last row of the sheet and then you try and offset one row below that.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    11-09-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Runtime error 1004 - help needed!

    OMG thanks!!! it works now...amazing lol

    Can you also help with instead of clearing content of the row to simple delete the row after content has been copied to "archives" sheet

    Thanks!

    Quote Originally Posted by romperstomper View Post
    1. Please use code tags.
    2. Better to use xlUp rather than xlDown:
    Please Login or Register  to view this content.
    Otherwise, if A2 is blank, your xlDown takes you to the last row of the sheet and then you try and offset one row below that.

  4. #4
    Registered User
    Join Date
    11-09-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Runtime error 1004 - help needed!

    Hum it seems that each time I archive the row it overwrites the first row on "Archives" sheet, meaning instead of taking the next empty row it is always using the first row...

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Runtime error 1004 - help needed!

    For example:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-09-2012
    Location
    Brussels
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Runtime error 1004 - help needed!

    Perfect! thanks a bunch, issue is completely solved!!!!

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Runtime error 1004 - help needed!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] 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
  4. Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM
  5. Runtime '1004' Error
    By Dave_2k5 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-10-2005, 07:44 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