#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Sort issue

Hi,

I am trying to sort a group of cells on another page with vba. I keep
getting a select method of Range Class Failed error. What am I doing wrong?
I have checked all variables and they have the correct values.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I also tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Tablespg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Thanks for your help.
Karen53
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Sort issue

You kind of answered your own question. You cannot select a range that is not
on the activesheet. You can either select the Tablespg first or rewrite your
code to work without selecting. Let me know if you need help with either
solution.
--
Charles Chickering

"A good example is twice the value of good advice."


"Karen53" wrote:

Hi,

I am trying to sort a group of cells on another page with vba. I keep
getting a select method of Range Class Failed error. What am I doing wrong?
I have checked all variables and they have the correct values.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I also tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Tablespg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Thanks for your help.
Karen53

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Sort issue

Hi Charles,

I had tried that as well and it did not work so I switched to select. I am
not at work now but I believe this is what I tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow). _
Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
--
Thanks for your help.
Karen53


"Charles Chickering" wrote:

You kind of answered your own question. You cannot select a range that is not
on the activesheet. You can either select the Tablespg first or rewrite your
code to work without selecting. Let me know if you need help with either
solution.
--
Charles Chickering

"A good example is twice the value of good advice."


"Karen53" wrote:

Hi,

I am trying to sort a group of cells on another page with vba. I keep
getting a select method of Range Class Failed error. What am I doing wrong?
I have checked all variables and they have the correct values.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I also tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Tablespg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Thanks for your help.
Karen53

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Sort issue

Hi Charles,

It doesn't appear my post processed correctly. Thank you for your help.

I had tried to eliminate select but it didn't work wo I switched to select.
I'm not at work now but I believe this is what I tried.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow). _
Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Did I miss something?

--
Thanks for your help.
Karen53


"Charles Chickering" wrote:

You kind of answered your own question. You cannot select a range that is not
on the activesheet. You can either select the Tablespg first or rewrite your
code to work without selecting. Let me know if you need help with either
solution.
--
Charles Chickering

"A good example is twice the value of good advice."


"Karen53" wrote:

Hi,

I am trying to sort a group of cells on another page with vba. I keep
getting a select method of Range Class Failed error. What am I doing wrong?
I have checked all variables and they have the correct values.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I also tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Tablespg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Thanks for your help.
Karen53

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sort issue

You didn't qualify your key1 range:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow). _
Sort Key1:=tablspg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

And if I know my data, I don't allow excel to guess if I have headers or not. I
use xlyes or xlno--not xlguess.

Karen53 wrote:

Hi Charles,

It doesn't appear my post processed correctly. Thank you for your help.

I had tried to eliminate select but it didn't work wo I switched to select.
I'm not at work now but I believe this is what I tried.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow). _
Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Did I miss something?

--
Thanks for your help.
Karen53

"Charles Chickering" wrote:

You kind of answered your own question. You cannot select a range that is not
on the activesheet. You can either select the Tablespg first or rewrite your
code to work without selecting. Let me know if you need help with either
solution.
--
Charles Chickering

"A good example is twice the value of good advice."


"Karen53" wrote:

Hi,

I am trying to sort a group of cells on another page with vba. I keep
getting a select method of Range Class Failed error. What am I doing wrong?
I have checked all variables and they have the correct values.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I also tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Tablespg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Thanks for your help.
Karen53


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Sort issue

Thank you, Dave!
--
Thanks for your help.
Karen53


"Dave Peterson" wrote:

You didn't qualify your key1 range:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow). _
Sort Key1:=tablspg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

And if I know my data, I don't allow excel to guess if I have headers or not. I
use xlyes or xlno--not xlguess.

Karen53 wrote:

Hi Charles,

It doesn't appear my post processed correctly. Thank you for your help.

I had tried to eliminate select but it didn't work wo I switched to select.
I'm not at work now but I believe this is what I tried.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow). _
Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Did I miss something?

--
Thanks for your help.
Karen53

"Charles Chickering" wrote:

You kind of answered your own question. You cannot select a range that is not
on the activesheet. You can either select the Tablespg first or rewrite your
code to work without selecting. Let me know if you need help with either
solution.
--
Charles Chickering

"A good example is twice the value of good advice."


"Karen53" wrote:

Hi,

I am trying to sort a group of cells on another page with vba. I keep
getting a select method of Range Class Failed error. What am I doing wrong?
I have checked all variables and they have the correct values.

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I also tried:

Tablespg.Range(ItemCol & ItemFRow & ":" & PoolCol & Lusedrow).Select
Selection.Sort Key1:=Tablespg.Range(ItemCol & ItemFRow), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Thanks for your help.
Karen53


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort Issue Texins Karate Excel Discussion (Misc queries) 2 December 14th 09 06:16 PM
Issue with Sort robs3131 Excel Programming 23 June 6th 07 10:20 PM
sort issue Shawn Excel Programming 9 September 23rd 06 06:56 PM
Sort Issue tbobo Excel Programming 3 March 8th 06 06:01 PM
Sort issue Patty[_2_] Excel Programming 9 December 12th 03 09:47 PM


All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"