LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
MWS MWS is offline
external usenet poster
 
Posts: 53
Default Aborting Execution Before Error Message

Hello, My goal is to have code to, upon activating a sheet, to unprotect the
sheet if the user imputs the correct password and then complete some other
tasks (the "other" portion I have figured out. The code is as follows:

Private Sub Worksheet_Activate()
If ActiveSheet.Protect = False Then
ActiveSheet.Unprotect
Rows("2:5000").Select
Selection.EntireRow.Hidden = False
Range("A1:L5004").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Range("A1").Select
End If

The issue is, if the user does not value the correct password, they receive
an error. My question is: What is the code to be added so if the user inputs
the correct password the code continues and if the incorrect password is
valued the execution aborts and the error meesage is not presented (I realize
the user just needs to click "end" when then error is received, but I'd like
to have a cleaner process).

Any and All Help Is Appreciated - Thank You
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Execution Message canderson Excel Discussion (Misc queries) 1 October 9th 09 04:28 PM
How to ged rid of the "Execution Error 9" message at the file opening? frenchbox Excel Discussion (Misc queries) 0 July 31st 06 03:28 PM
message without stopping execution? Stefi Excel Programming 19 July 14th 05 12:08 PM
Code Execution has been interrupted message Rich in Yorktown Excel Programming 1 December 20th 04 05:41 PM
Message Box Execution Myrna Rodriguez Excel Programming 1 June 24th 04 06:34 PM


All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"