Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Help, Please!
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.SortField s.Clear ActiveWorkbook.Worksheets("Export").Sort.SortField s.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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Help, Please!
Sorting is quite a bit differnet in 2007. Try this in 2003
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").Sort Key1:=Range("H2"), Order1:=xlDescending, _ Header:=xlYes End Sub -- HTH... Jim Thomlinson "mrajoo" wrote: 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.SortField s.Clear ActiveWorkbook.Worksheets("Export").Sort.SortField s.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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy and paste values (columns)I have a macro file built | Excel Programming | |||
AutoRun Macro with a delay to give user the choice to cancel the macro | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |