If that sheet is not the activesheet then yes...........you must refer to it.
Sub foo()
With Sheets("Details")
Cells.Select
Selection.Sort Key1:=Range("E1"), Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With
End Sub
Gord
>I might need to refer to the worksheet in the code. It is called
>"Details".
[quoted text clipped - 28 lines]
>>
>> > >dzelnio
Where syntax error on this script...
Sub Sortdescending()
With Sheets("Details")
Cells.Select
Selection.Sort Key1:=Range("E1"), Order1:=xlDescending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With
End Sub
=====
> If that sheet is not the activesheet then yes...........you must refer to it.
>
[quoted text clipped - 40 lines]
>
> >> > >dzelnio
Dave Peterson - 20 Jun 2007 22:15 GMT
How about:
Sub foo()
With Sheets("Details")
with .usedrange 'column A to whatever?
.cells.sort Key1:=.columns(5), Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
end with
end with
End Sub
> Where syntax error on this script...
>
[quoted text clipped - 54 lines]
> >
> > >> > >dzelnio

Signature
Dave Peterson
dzelnio - 20 Jun 2007 22:23 GMT
The syntax error lands on Sub foo()
??
> How about:
>
[quoted text clipped - 69 lines]
>
> Dave Peterson
Dave Peterson - 20 Jun 2007 22:30 GMT
Delete that line and then retype that line.
You may have extra (invisible) characters that you can't see.
> The syntax error lands on Sub foo()
> ??
[quoted text clipped - 72 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Gord Dibben - 20 Jun 2007 22:27 GMT
Which line is highlighted when you get the error?
That should tell you something.
Works for me as written so don't get any syntax errors to look for.
This line is all one line...........should show in red font if you have it in
your module as two or three lines without a line continuation character as your
post shows
Selection.Sort Key1:=Range("E1"),Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Gord
>Where syntax error on this script...
>
[quoted text clipped - 54 lines]
>>
>> >> > >dzelnio
Dave Peterson - 20 Jun 2007 23:02 GMT
You'd also want to select that worksheet:
With Sheets("Details")
.select
Cells.Select
> Which line is highlighted when you get the error?
>
[quoted text clipped - 69 lines]
> >>
> >> >> > >dzelnio

Signature
Dave Peterson
Gord Dibben - 20 Jun 2007 23:12 GMT
Why select it?
Gord
>You'd also want to select that worksheet:
>
[quoted text clipped - 75 lines]
>> >>
>> >> >> > >dzelnio
Dave Peterson - 20 Jun 2007 23:17 GMT
If details isn't the activesheet, then
cells.select will be selecting the cells on whatever sheet is active.
And selection.sort will be sorting the selection on whatever sheet is active.
But I wouldn't select it either. I'd just make sure every range object is
qualified with worksheets("details").
> Why select it?
>
[quoted text clipped - 79 lines]
> >> >>
> >> >> >> > >dzelnio

Signature
Dave Peterson
Gord Dibben - 20 Jun 2007 23:39 GMT
So right.
I was testing with Details sheet active so did not notice.
It's the new drugs<g>
Gord
>If details isn't the activesheet, then
>cells.select will be selecting the cells on whatever sheet is active.
[quoted text clipped - 86 lines]
>> >> >>
>> >> >> >> > >dzelnio
Peo Sjoblom - 20 Jun 2007 23:55 GMT
Cialis?
Peo
> It's the new drugs<g>
>
[quoted text clipped - 110 lines]
>>> >> >>
>>> >> >> >> > >dzelnio
Gord Dibben - 21 Jun 2007 00:27 GMT
I wish it were that simple.
Gord
>Cialis?
>
[quoted text clipped - 114 lines]
>>>> >> >>
>>>> >> >> >> > >dzelnio
dzelnio - 21 Jun 2007 16:17 GMT
The macro is working for now. It is part of a larger script, so I'll
be testing it for a couple of days...
This process has taken me way too many hours. You guys probably could
have done it in your sleep.
Thanks for the help!
dzelnio
> I wish it were that simple.
>
[quoted text clipped - 118 lines]
>
> >>>> >> >> >> > >dzelnio
Peo Sjoblom - 21 Jun 2007 16:39 GMT
Are you still smoking?
Peo
>I wish it were that simple.
>
[quoted text clipped - 125 lines]
>>>>> >> >>
>>>>> >> >> >> > >dzelnio
Gord Dibben - 21 Jun 2007 17:35 GMT
Didn't smoke for 10 months last year but started again in December
Gord
>Are you still smoking?
>
[quoted text clipped - 129 lines]
>>>>>> >> >>
>>>>>> >> >> >> > >dzelnio
Gord Dibben - 20 Jun 2007 23:56 GMT
The old ones were not much better but I'm sure you will drop that in
somewhere<g>
Gord
>So right.
>
[quoted text clipped - 3 lines]
>
>Gord