jake.peterson
Board Regular
- Joined
- May 22, 2012
- Messages
- 68
I recorded this macro to sort a multiple ranges on the same sheet. It runs fine on my machine, but when I email it to someone else they get a runtime error 1004.
Any idea why or how I can fix it?
Sub Sort_Owner()
Range("C7:J26").Select
Selection.Sort Key1:=Range("E7"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=18
Range("C29:J48").Select
ActiveWindow.SmallScroll ToRight:=-2
Application.Width = 1080
Application.Height = 748.5
With ActiveWindow
.Width = 1068.75
.Height = 576.75
End With
Selection.Sort Key1:=Range("E29"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=21
Range("C51:J70").Select
Selection.Sort Key1:=Range("E51"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=18
Range("C73:J92").Select
Selection.Sort Key1:=Range("E73"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=24
Range("C95:J114").Select
Selection.Sort Key1:=Range("E95"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=27
Range("C117:J136").Select
Selection.Sort Key1:=Range("E117"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=21
Range("C139:J158").Select
Selection.Sort Key1:=Range("E139"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=21
Range("C161:J180").Select
Selection.Sort Key1:=Range("E161"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=-18
Selection.Sort Key1:=Range("E161"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=18
Range("a6").Select
End Sub
Thanks
Any idea why or how I can fix it?
Sub Sort_Owner()
Range("C7:J26").Select
Selection.Sort Key1:=Range("E7"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=18
Range("C29:J48").Select
ActiveWindow.SmallScroll ToRight:=-2
Application.Width = 1080
Application.Height = 748.5
With ActiveWindow
.Width = 1068.75
.Height = 576.75
End With
Selection.Sort Key1:=Range("E29"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=21
Range("C51:J70").Select
Selection.Sort Key1:=Range("E51"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=18
Range("C73:J92").Select
Selection.Sort Key1:=Range("E73"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=24
Range("C95:J114").Select
Selection.Sort Key1:=Range("E95"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=27
Range("C117:J136").Select
Selection.Sort Key1:=Range("E117"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=21
Range("C139:J158").Select
Selection.Sort Key1:=Range("E139"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=21
Range("C161:J180").Select
Selection.Sort Key1:=Range("E161"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=-18
Selection.Sort Key1:=Range("E161"), Order1:=xlDescending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=18
Range("a6").Select
End Sub
Thanks