View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default sort on not active sheet

does this help?
Sub sort()
With Sheets("sheet1")
.Range("a8:s57").sort Key1:=.Range("s8"), Order1:=xlAscending,
Header:=xlGuess
End With
End Sub

--
Don Guillett
SalesAid Software

"peter_bhp" wrote in message
ups.com...
Hello everyone,

I've tried finding my answer in this newsgroup but couldn't find it
using the subject line of this message.

This macro doesn't work:

Sub Sort(Object As String)
Debug.Print Chr(13) & "****Begin subSort****" & Chr(13)
Debug.Print " Object = " & Object
Sheets(Object).Range("A8:S57").Sort _
Key1:=Range("S8"), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Debug.Print Chr(13) & "****End subSort****" & Chr(13)
End Sub

This macro is called from a Worksheet_Change event.

I've adjusted the code from a recorded macro (which does work) to
include the sheet name that has the range that was mentioned (
range("A8:S57") )

Wouldn't it be great to have an answer to this message this evening of
all evenings? (At this moment it is 18:05 in Holland, so ...)
Thank you in advance.

Peter E.