+ Reply to Thread
Results 1 to 2 of 2

Type Mismatch error ==> do some code before exiting sub

  1. #1
    Registered User
    Join Date
    05-04-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    33

    Type Mismatch error ==> do some code before exiting sub

    Hi,

    Below is a segment of my code it:
    1. unprotects the sheet with password
    2. asks the user to input an integer
    3. executes the body of the code
    4. protects the sheet with password

    If the user hits the Escape key or click the Cancel button in step 2, I get the Type Mismatch error but the sheet is still unprotected.

    How can I protect the sheet with the password before exiting the macro. Thanks.

    Please Login or Register  to view this content.
    Last edited by drawing.blanks; 06-27-2012 at 11:34 PM.

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Type Mismatch error ==> do some code before exiting sub

    Give this a whirl,

    Please Login or Register  to view this content.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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