Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Require assist with VBA semantic regarding worksheet selection

Hello,

I have the following subroutine for sorting a table:

Sheets("Quotes").Range("A5:AB500").Sort Key1:=Range("A5"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

This works fine when I the worksheet in question "Quotes" is
the active worksheet. However, when I invoke this macro while
another worksheet is open, I get an error.

Any assist with this is greatly appreciated.

Thanks
Jeff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Require assist with VBA semantic regarding worksheet selection

Hi Jeff

That is because Range("A5") points to the active sheet. Try

Sheets("Quotes").Range("A5:AB500").Sort Key1:=Sheets("Quotes").Range("A5"),
....

HTH. Best wishes Harald

"Jeff Stryer" skrev i melding
om...
Hello,

I have the following subroutine for sorting a table:

Sheets("Quotes").Range("A5:AB500").Sort Key1:=Range("A5"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

This works fine when I the worksheet in question "Quotes" is
the active worksheet. However, when I invoke this macro while
another worksheet is open, I get an error.

Any assist with this is greatly appreciated.

Thanks
Jeff



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Require assist with VBA semantic regarding worksheet selection

Harald - You are my hero. Thanks for taking time to reply.

Best Wishes
Jeff



"Harald Staff" wrote in message ...
Hi Jeff

That is because Range("A5") points to the active sheet. Try

Sheets("Quotes").Range("A5:AB500").Sort Key1:=Sheets("Quotes").Range("A5"),
...

HTH. Best wishes Harald

"Jeff Stryer" skrev i melding
om...
Hello,

I have the following subroutine for sorting a table:

Sheets("Quotes").Range("A5:AB500").Sort Key1:=Range("A5"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

This works fine when I the worksheet in question "Quotes" is
the active worksheet. However, when I invoke this macro while
another worksheet is open, I get an error.

Any assist with this is greatly appreciated.

Thanks
Jeff

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
Lock worksheet, based on dropdown selection prior worksheet Michele New Users to Excel 9 June 21st 09 10:31 PM
why does worksheet require two different forms of same formulas nothappy Excel Worksheet Functions 7 April 26th 09 06:18 PM
Please assist... soke2001 Excel Worksheet Functions 3 September 15th 07 01:59 PM
Formula Assist [email protected] Excel Discussion (Misc queries) 3 June 7th 06 12:37 AM
Please assist Bubba_James Excel Worksheet Functions 1 September 9th 05 06:28 PM


All times are GMT +1. The time now is 09:56 AM.

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

About Us

"It's about Microsoft Excel"