Results 1 to 5 of 5

Macro and grouping not working in Protected sheet

Threaded View

  1. #1
    Registered User
    Join Date
    07-18-2012
    Location
    germany
    MS-Off Ver
    Excel 2007
    Posts
    6

    Macro and grouping not working in Protected sheet

    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
    Last edited by ranjuv; 08-27-2012 at 08:47 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1