Hello,
I have the following macro code in my "Overview" excel sheet. I recorded the macro and it works perfectly.
The problem is that i have grouped some fields and after the sheet is protected, the grouping doesnt work anymore.
It says remove the protection and try again. I have used no password to protect the file.
Sub Add_Row_Sort()
'
' Add_Row_Sort Macro
' Add a row and sort by deadline and priority
'
'
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Range("B9:Y9").Select
Selection.ListObject.ListRows.Add (2)
ActiveWorkbook.Worksheets("Overview").ListObjects("Table1").Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("Overview").ListObjects("Table1").Sort.SortFields. _
Add Key:=Range("Table1[Deadline]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Overview").ListObjects("Table1").Sort.SortFields. _
Add Key:=Range("Table1[Prio]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Overview").ListObjects("Table1").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Protect
Application.ScreenUpdating = True
Range("B8").Select
End Sub
Thanks in advance,
Ranju
Bookmarks