this code goes on the Workbook module sheet and sort columns a & b of
the active sheet
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Columns("A:B").Sort Key1:=Range("A1"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
With that sample I get "Compile Error Expected: type name
You'll have to excuse me as I am relatively new to trying to mess with
excel. Any help appreciated. Thanks in Advance
Here is the code I am trying:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Columns("C").Sort Key1:=Range("C12:C20"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub