ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with Sort Method After Paste (https://www.excelbanter.com/excel-programming/373931-problem-sort-method-after-paste.html)

AmytDev

Problem with Sort Method After Paste
 
Can anyone find out what is wrong with this code? I can't figure out why I
get error 1004 Sort Method of Range Class Failed when I click the custom
command button.

Sub Sort()
Range("B73:D85").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=17
Range("B91:D103").Select
ActiveSheet.Paste Link:=True
Application.CutCopyMode = False
Range("B91:D103").Select
Selection.Sort Key1:=Range("B91"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub


Tom Ogilvy

Problem with Sort Method After Paste
 
code ran fine for me.

after the code errors, can you go to Data=Sort and sort the selection
manually?

--
Regards,
Tom Ogilvy


"AmytDev" wrote:

Can anyone find out what is wrong with this code? I can't figure out why I
get error 1004 Sort Method of Range Class Failed when I click the custom
command button.

Sub Sort()
Range("B73:D85").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=17
Range("B91:D103").Select
ActiveSheet.Paste Link:=True
Application.CutCopyMode = False
Range("B91:D103").Select
Selection.Sort Key1:=Range("B91"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub



All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com