+ Reply to Thread
Results 1 to 7 of 7

Run -time error 1004 using a VBA

  1. #1
    Registered User
    Join Date
    05-19-2014
    MS-Off Ver
    Excel 2003
    Posts
    12

    Run -time error 1004 using a VBA

    I have this VBA to saves changes (date Values) on cells as comments, but when I run a date picker (an add in ) I get an error which says the following:

    Run-time error 1004
    Method Undo of objet Application failed
    Please what can I do??

    This is the VBA

    Please Login or Register  to view this content.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Run -time error 1004 using a VBA

    That's working for me in my test. Are you doing something specific that is causing it to fail?
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Run -time error 1004 using a VBA

    Well, you can get around using the Application.undo (which I finally was able to make break the function) by using a History Column.

    Here's what I did:

    -I named the column I want to track trackedColumn and the column that holds the last value historyColumn. I made these workbook-scoped names available to VBA using bracketed expressions: [trackedColumn] and [historyColumn].

    -ALSO I noticed you were having trouble with user updates involving more than one cell at a time (hence the check target.count...) - You can get around that problem (and still capture changes of more than one cell at a time due to larger copy/paste operations) by using a FOR EACH loop.

    FIRST CHECK BECOMES:
    Please Login or Register  to view this content.
    LOOP IS (which is only reached IF the first check is passed - meaning we have at least one change in the tracked column to make note of... could be many cells)

    Please Login or Register  to view this content.

    FULL Macro for worksheet_change event handling:

    Please Login or Register  to view this content.

    -That history column can be buried away on some hidden control sheet also. Anyway, that's my thoughts on it - would be preferable IMO to using the undo option.

    Also, if you wanted to get the comment out of the way - you could place it on the history column. Instead of Target.NoteText you would just use [historyColumn].cells(c.row,1).NoteText.
    Attached Files Attached Files
    Last edited by GeneralDisarray; 07-17-2015 at 09:51 AM. Reason: EDIT - Attached Example

  4. #4
    Registered User
    Join Date
    05-19-2014
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run -time error 1004 using a VBA

    Hi , Yes Yes it works when I put the dates on columns T manually, BUT if I use the Date picker Add inn, it stops working and give the Run Time error 1004 and the VBA stops working until I shut down excel and I start from new.

    What could ti be

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Run -time error 1004 using a VBA

    Are you talking about my code or your original code?

    Were you able to try what i posted?

  6. #6
    Registered User
    Join Date
    05-19-2014
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run -time error 1004 using a VBA

    Yes my original code , the problem is that when ever I run the Date Picker Add inn , the VBA stop working .. i am afraid there muss be a mishmash between VBAs and the Date picker Add In

  7. #7
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Run -time error 1004 using a VBA

    Ok, seeing as that is the case, you might want to try something else. Have you tried what I posted??

+ 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] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  2. Addon error : Run-time error '1004': Method 'MacroOptions' of object '_Application' failed
    By jtcoleman in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 02-05-2014, 12:23 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. 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
  6. Excel Macro Error - Run time error 1004 - Paste method of worksheet class failed
    By kvflynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 10:51 AM
  7. [SOLVED] run-time error '1004': Application-defined or object-deifined error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2005, 05:05 PM

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