Hi,
Firstly, I have a very limited Excel vocabulary and experience with macros so please forgive the awkwardness of my question.
I have created a protected excel worksheet sheet which colleagues in different states fill in. My colleagues would like to be able to sort the data. I tried to give this permission through the Review tab however after reading many forum sites it appears this feature is almost cosmetic and not what I am after.
I have since looked for appropriate macros but my limited understanding of creating scripts means unless the macro is specific for my scenario I cannot use it. From my reading I gather I do not want to use the command userinterface as my colleagues in different states are even less savvy them me and will not want to have reset the command each time they open the worksheet. I have since tried the following macro which did nothing:
Sub ProtectWithAutoFilterAndSortCapabilities()
With Sheets("Proposed")
ActiveSheet.Unprotect Password:="caveman", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
End With
ActiveSheet.Protect Password:="caveman"
End Sub
I also realized I was unsure what this macro would allow me to do if it worked ie does this mean my colleagues can open the sheet go to the sort tab and specify the column they want to.
So I was worried that I needed to specify a range to base the sorting on and tried this macro instead (unsuccessfully
0:
Sub Macro2()
Columns("A:AH").Select
ActiveWorkbook.Worksheets("Proposed").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Proposed").Sort.SortFields.Add Key:=Range("I3:I2000"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Proposed").Sort
.SetRange Range("A3:AH2000") .Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub
So as you can see I have made myself very confused. Can you please help me develop a macro for my specific purpose.
I have columns A-AH and the data starts in A3. I would like to specify a dynamic range for row numbers hence the A2000 (although currently there are only approximately 25 entries). I would like to sort the data based on column I which is a date. AND the sheet is protected.
Thank you for your consideration and please let me know if I need to provide additional informational or an example sheet
Kind regards
Kerri
Bookmarks