lmmay
Board Regular
- Joined
- Jun 6, 2014
- Messages
- 87
I am using the following to sort an excel sheet:
Sub Sort()
'Unprotect Worksheet
ActiveSheet.UnProtect Password:=" cover700"
Selection.Sort Key1:=Range(Selection.Address), Order1:=xlAscending, DataOption1:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Password:=" cover700", Scenarios:=True _
, AllowFormattingColumns:=True, AllowDeletingRows:=True, AllowSorting:=True
End Sub
Except for the last line, the code works well sorting on column 1.
I need to modify the script to allow the user to select a different column to sort using an input box.
Any help would be greatly appreciated.
Sub Sort()
'Unprotect Worksheet
ActiveSheet.UnProtect Password:=" cover700"
Selection.Sort Key1:=Range(Selection.Address), Order1:=xlAscending, DataOption1:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Password:=" cover700", Scenarios:=True _
, AllowFormattingColumns:=True, AllowDeletingRows:=True, AllowSorting:=True
End Sub
Except for the last line, the code works well sorting on column 1.
I need to modify the script to allow the user to select a different column to sort using an input box.
Any help would be greatly appreciated.