Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

get an error when I run a macro

  Asked By: Abelerd    Date: Aug 22    Category: MS Office    Views: 930
  

In the excel sheet, I press ctrl-a to start a macro to sort data. I
get the following error Run-time error '1004': Application-defined
or object-defined error. This is the following code. It errors out
on the selection sort line

Sub Sort_results()
'
' Sort_results Macro
' Macro recorded 3/28/2007 by David I. Thal
'
' Keyboard Shortcut: Ctrl+a
'
Range("B5:B11").Select
Selection.Copy
Range("E5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("E5"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Any ideas??????? If you want the excel sheet, let me know. I will
send it to you.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Reamonn Fischer     Answered On: Aug 22

In the excel  sheet, I press  ctrl-a to start  a macro  to sort  data. I
get the following error  Run-time error '1004': Application-defined
or object-defined error. This is the following code. It errors out
on the selection sort line

Sub Sort_results()
'
' Sort_results Macro
' Macro recorded 3/28/2007 by David I. Thal
'
' Keyboard Shortcut: Ctrl+a
'
Range("B5:B11").Select
Selection.Copy
Range("E5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("E5"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Any ideas??????? If you want the excel sheet, let me know. I will
send it to you.

 
Didn't find what you were looking for? Find more on get an error when I run a macro Or get search suggestion and latest updates.




Tagged: