+ Reply to Thread
Results 1 to 4 of 4

Auto sort on a protected sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    12-21-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Auto sort on a protected sheet

    In need of help with no programming knowledge. Using excel 2010
    I have two columns one for names and the other for their respective wages. Need to know if it can auto arrange alphabetically order while the sheet is being protected. (see attachment)

    Happy Holidays, and Merry new year to everyone
    LOL
    Attached Files Attached Files

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Auto sort on a protected sheet

    And a Happy Holidays to you...

    Based on your sample...

    Right click sheet tab and paste on right side of screen

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rng As Range
        Dim srcSht As Worksheet: Set srcSht = Sheets("Sheet1")
        Dim LR As Long: LR = Range("A" & Rows.Count).End(xlUp).Row
        Set rng = Range("A5:C" & LR)
        Application.ScreenUpdating = False
        srcSht.Unprotect Password:="password"
        With srcSht.Sort
        .SortFields.Clear
        .SortFields.Add Key:=Range("B6:B" & LR), _
                        SortOn:=xlSortOnValues, _
                        Order:=xlAscending, _
                        DataOption:=xlSortNormal
        .SetRange rng
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
        End With
        Application.ScreenUpdating = True
        srcSht.Protect Password:="password"
    End Sub
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    12-21-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Auto sort on a protected sheet

    Thanks

    Happy holidays to you and your love ones

    Regards

    Luis

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Auto sort on a protected sheet

    You are very welcome and same to you Luis.

+ Reply to Thread

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