Limiting Sort Ranges

D

DCSwearingen

We have several spreadsheets in which we track production line downtime
(I would prefer to do this in Access, and we even paid a small fee t
have a database created to do it, but people are so use to Excel tha
implementing the Access application proved to be impractical)

Operators like to sort the rows in this, however they are constantl
ending up with the header row being sorted as data instead of as th
header.

What I have done is to protect the spreadsheet, create a startup macr
that unprotects & brings up a data form. Once the data form is close
the macro then protects the sheet again.

They have a button that will run the startup marco again if they nee
to enbter additional data (or even edit existing data by scrollin
through the records).

I have a macro that will sort for them:

Sub SortSelection()
Dim myRow As Single
myRow = Selection.Row
Select Case myRow
Case 1
ExitMessage
Exit Sub
Case 2
ExitMessage
Exit Sub
End Select
ActiveSheet.UnProtect (myPW)
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Rang
_
("B2"), Order2:=xlAscending, _
Key3:=Range("H2"), Order3:=xlAscending, Header:=xlNo
OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
Range("A4").Select
Selection.End(xlDown).Select
ActiveSheet.Protect password:=myPW
P2Down = True
End Su
 
Top