Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"