Macro generates error 1004

B

Brian

I created the following macro which works fine on my excel
2002. When I sent it to two coworkers they each get the
error message "run-time error '1004': application-defined
or object-defined error". They each have excel 2000. The
macro text is below. What's the cause and fix?

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 8/6/2004 by Intuit
'
' Keyboard Shortcut: Ctrl+p
'
Range("C2:G22").Select
Selection.Sort Key1:=Range("G3"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
 
M

Max

Just some thoughts .. not sure why ..
but when I stripped off the last part, viz.:
, _
DataOption1:=xlSortNormal

leaving only:
Range("C2:G22").Select
Selection.Sort Key1:=Range("G3"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

I could get the macro to work in Excel 97
 
D

Dave Peterson

Dataoption1 was added in xl2002.

Removing it will make it work ok previous versions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top