If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Sorting Issue while protected

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-01-06, 16:18
Burnedout Burnedout is offline
Registered User
 
Join Date: Aug 2004
Location: Aurora, Ontario
Posts: 10
Angry 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
Reply With Quote
  #2 (permalink)  
Old 01-02-06, 12:38
shades shades is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-02-06, 23:10
Burnedout Burnedout is offline
Registered User
 
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 00:23.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On