S
steve
Hello.
I want to have a macro that will do the following (when
the button or shortcut keys are used):
1) automatically enter a password to unprotect a sheet, 2)
opens up the 'sort' function so the user can select which
columns to sort from 3)sorts the file, then re-protects
the spreadsheet so no changes can be made to the data.
Here is where I am:
Sub sort()
With ActiveSheet
.Unprotect password:="wwca"
Selection.sort Key1:=Range("B1"), Order1:=xlAscending,
Key2:=Range("D1") _
, Order2:=xlDescending, Key3:=Range("F1"),
Order3:=xlAscending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
.Protect password:="your_password"
End With
End Sub
The Key1, Key2, Key3 ranges would be user input fields.
Thanks.
I want to have a macro that will do the following (when
the button or shortcut keys are used):
1) automatically enter a password to unprotect a sheet, 2)
opens up the 'sort' function so the user can select which
columns to sort from 3)sorts the file, then re-protects
the spreadsheet so no changes can be made to the data.
Here is where I am:
Sub sort()
With ActiveSheet
.Unprotect password:="wwca"
Selection.sort Key1:=Range("B1"), Order1:=xlAscending,
Key2:=Range("D1") _
, Order2:=xlDescending, Key3:=Range("F1"),
Order3:=xlAscending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
.Protect password:="your_password"
End With
End Sub
The Key1, Key2, Key3 ranges would be user input fields.
Thanks.