I have trouble in the hidden sheet range

K

kvenku

Hi,
I need to sort a bunch of values to ascending order. So i used t
store the values in the HiddenSheet (Sheet1).

I am using this code

Sheet1.Range("A13:A35").Select
Selection.Sort Key1:=Range("A13"), Order1:=xlAscending
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

The sorting is not working in the hidden sheet why?

But the sorting is working if in current sheet

Range("A13:A35").Select
Selection.Sort Key1:=Range("A13"), Order1:=xlAscending
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Is there any other way to acheived this. PLease do reply me soon

Thanks

Venkatesh
 
D

Don Guillett

Hidden doesn't matter
You cannot select a range this way. Use

Sheets("sheet1").select
Range("A13:A35").Select
Selection.Sort Key1:=Range("A13"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

OR to sort it without going to the sheet at all.

Sheets("sheet1").Range("A13:A35").Sort Key1:=sheets("sheet1").Range("A13"),
_
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
 
T

Tom Ogilvy

Hidden doesn't allow selecting, so use Don's second approach.

--
Regards,
Tom Ogilvy

Don Guillett said:
Hidden doesn't matter
You cannot select a range this way. Use

Sheets("sheet1").select
Range("A13:A35").Select
Selection.Sort Key1:=Range("A13"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

OR to sort it without going to the sheet at all.

Sheets("sheet1").Range("A13:A35").Sort Key1:=sheets("sheet1").Range("A13"),
_
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
 
Top