View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Sheet names in a macro

or from anywhere in the workbook withOUT selecting

Sub SortSheet52()
with sheets("sheet52").Range("A3:K299")
..Sort Key1:=.Range("B3"), Order1:=xlDescending,Key2:=.Range("A3") _
,Order2:=xlAscending, Header:=xlGuess,OrderCustom:=1
end with
End Sub


--
Don Guillett
SalesAid Software

"bern" wrote in message
...

Hi All
Many thanks guys
Sorted it, once again thanks to your invalueable help.
Instead of:

Sub SortSheet52()
Application.ScreenUpdating = False
SHEETS(\"SHEET52\").ACTIVATE
RANGE(\"A3:K299\").SELECT
Selection.Sort Key1:=Range("B3"), Order1:=xlDescending,
Key2:=Range("A3") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A2").Select
End Sub

Used the

Sub SortSheet52()
Dim sh as Worksheet
Application.ScreenUpdating = False
SET SH = SHEET52
SH.ACTIVATE
Range("A3:K299").Select
Selection.Sort Key1:=Range("B3"), Order1:=xlDescending,
Key2:=Range("A3") _, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A2").Select
End Sub


Once again thanks
:)
Bern


--
bern
------------------------------------------------------------------------
bern's Profile:
http://www.excelforum.com/member.php...o&userid=20169
View this thread: http://www.excelforum.com/showthread...hreadid=533158