View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Slow1911s[_13_] Slow1911s[_13_] is offline
external usenet poster
 
Posts: 1
Default Help with multiple sorts, multiple sheets


The first sort is on the same sheet as the command button - everythin
else is on "sheet4". The refresh and first sort works - then I get
1004 error. Here is what I have right now.


Private Sub CommandButton1_Click()
Dim ws2 As Excel.Worksheet
Dim ws3 As Excel.Worksheet
Set ws2 = sheets("sheet4")
Set ws3 = sheets("Rep Summary")

ActiveWorkbook.RefreshAll

Range("A104:B121").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Range("c104:c105"), _
Unique:=False


With ws2
.Range("a2:a10000").AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("e2:e10000"), _
Unique:=True
.Range("E2:E10000").Sort _
Key1:=.Range("E2"), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

.Range("i2:i10000").Sort _
Key1:=.Range("i2"), _
Order1:=xlDescending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

.Range("j2:j10000").Sort _
Key1:=.Range("j2"), _
Order1:=xlDescending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With


Range("b12").Select


End Sub



--
Slow1911
-----------------------------------------------------------------------
Slow1911s's Profile: http://www.excelforum.com/member.php...fo&userid=3111
View this thread: http://www.excelforum.com/showthread.php?threadid=53751