Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Location
    Aurora, Ontario
    Posts
    10

    Angry Unanswered: Sorting Issue while protected

    The following code works perfectly but, I cannot get it to sort when the page is protected. I want to protect it so that people cannot make any other unauthorized changes but still be able to enter data into the Issued Hours column and have the columns sort when the Total Hours column changes

    Any thought would be greatly appreciated.



    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Column = 4 Then ' Total Hours

    With Range("A1:E" & Range("E30").End(xlUp).Row)
    .Sort key1:=Range("D2"), order1:=xlAscending, key2:=Range("E2"), order2:=xlAscending, header:=xlYes, ordercustom:=1, MatchCase:=fasle, _
    Orientation:=xlSortColumns


    End With

    End If

    If Target.Column = 5 Then
    Range("D" & Target.Row).Value = Range("D" & Target.Row).Value + _
    Cells(Target.Row, Target.Column).Value

    End If

    End Sub

  2. #2
    Join Date
    Oct 2003
    Posts
    1,091
    Howdy. It is far better to use the VBA method UserInterfaceOnly. This "protects" but allows all VBA to continue to be used.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  3. #3
    Join Date
    Aug 2004
    Location
    Aurora, Ontario
    Posts
    10

    Question Answer to Sorting Issue

    Thanks for the help it works great.

    Burnedout
    Last edited by Burnedout; 01-03-06 at 01:23.

Posting Permissions

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