M
mrajoo
Hi Everyone,
My Excel 2007 macro is not working in Excel 2003 as i'm getting a run-time
error '438' Object doesn't support this property or method as below. Any
help will be highly appreciated.
Sub SortByExport()
'
' SortByExport Macro
' Sort by Export column (prior to copying to Notepad).
'
' Keyboard Shortcut: Ctrl+Shift+S
' Recorded in Office 2007, then edited
Range("A1:H257").Select
'In Office 2003, the macro stops on the following line with the error
'message, "Object doesn't support this property or method":
ActiveWorkbook.Worksheets("Export").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Export").Sort.SortFields.Add
Key:=Range("H2:H257") _
, SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Export").Sort
.SetRange Range("A1:H257")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub
My Excel 2007 macro is not working in Excel 2003 as i'm getting a run-time
error '438' Object doesn't support this property or method as below. Any
help will be highly appreciated.
Sub SortByExport()
'
' SortByExport Macro
' Sort by Export column (prior to copying to Notepad).
'
' Keyboard Shortcut: Ctrl+Shift+S
' Recorded in Office 2007, then edited
Range("A1:H257").Select
'In Office 2003, the macro stops on the following line with the error
'message, "Object doesn't support this property or method":
ActiveWorkbook.Worksheets("Export").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Export").Sort.SortFields.Add
Key:=Range("H2:H257") _
, SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Export").Sort
.SetRange Range("A1:H257")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub