bobaroski2121
New Member
- Joined
- Jun 14, 2013
- Messages
- 13
I have been trying to convert a macro I am running in 2007 to 2003. I understand that the major difference is the sort function. I have been trying to update the macro with the 'Range.Sort(' to be used in 2003 but I have been unsuccessful. Where do I need to add the 'range.sort' in order for this macro to work in both '07 and '03?
Code:
Sub Macro1()'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+s
'
Dim sSheetName As String
sSheetName = ActiveSheet.Name
Range("A25:O2000").Select
ActiveWorkbook.Worksheets(sSheetName).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(sSheetName).Sort.SortFields.Add Key:=Range( _
"A26:A2000"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets(sSheetName).Sort
.SetRange Range("A25:O2000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub