Question

Locked

How do you sort a password protected worksheet

By HAMZEE ·
Tags: Off Topic
I was able to get Solution 1 in the article at the link below to work. However, how can I get this to work with a password protected worksheet?

http://articles.techrepublic.com.com/5100-10878_11-5234546.html?part=rss&tag=feed&subj=tr

The following is some code in another program that unlocks a password protected worksheet to release the filters, then it restore the pass word. Some how I need to intergrate the code in the article with the following code to unlock worksheet, sort the data by a specific column, the reapply the password.

Private Sub Workbook_Open()
Const PW As String = "123"
With Sheets("LOG") 'Change Sheet Name Here
If .FilterMode Then
.Unprotect Password:=PW
.ShowAllData
.Protect Password:=PW, DrawingObjects:=True, _
Contents:=True, Scenarios:=True, AllowFiltering:=True
End If
End With
End Sub

The worksheet has 5 columns and I want to sort by column 4 which is a date column.

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to After Hours Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums