+ Reply to Thread
Results 1 to 4 of 4

VBA to Cancel Last Action on Protected Sheet!

  1. #1
    Forum Contributor
    Join Date
    02-09-2015
    Location
    malta
    MS-Off Ver
    Microsoft 365
    Posts
    383

    VBA to Cancel Last Action on Protected Sheet!

    Hi all,

    If possible can someone please help me out with the below.

    Basically I have this code whose aim is to cancel the last action which was performed:

    Please Login or Register  to view this content.
    Now besides this simple code, I tried protecting the sheet and amended it to read:

    Please Login or Register  to view this content.
    However sometimes it is showing up an error:
    'Method 'Undo' of object'_Application failed.'

    I think it has something to do depending on what I did as my last action. If I manual input some data, the macro works fine. However if I don't input data it is showing up this error.

    If it is not too much to ask, can someone assist me with the above please. Maybe can I include a code which if it finds an error, it does not run the code?

    Appreciate a lot your kind help!!!

    Thanks

    keibri
    Last edited by Keibri; 12-20-2016 at 01:13 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: VBA to Cancel Last Action on Protected Sheet!

    undo is not available with VBA
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: VBA to Cancel Last Action on Protected Sheet!

    if all you want to do is skip the error then try:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Contributor
    Join Date
    02-09-2015
    Location
    malta
    MS-Off Ver
    Microsoft 365
    Posts
    383

    Re: VBA to Cancel Last Action on Protected Sheet!

    Hi guys thanks for your comments. Thanks Arkadi tried your solution with the on error and it worked great!! Thanks a lot !

+ 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] bug on the macro coded sheet, a protected sheet, every time i made an action i wanted
    By dondonordas in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-22-2014, 06:46 AM
  2. Replies: 1
    Last Post: 02-22-2014, 01:28 AM
  3. Replies: 2
    Last Post: 01-18-2014, 10:54 PM
  4. Problem with refresh all - "This action will cancel a pending.."
    By rajeshksv37 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-09-2009, 12:05 PM
  5. Action will Cancel Pending Refresh Command
    By mdk5008 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2009, 12:33 PM
  6. Cancel a message box pop up action
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-14-2009, 06:46 PM
  7. Replies: 0
    Last Post: 08-04-2006, 09:50 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