Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 347
Default Help with code:

Hi guys, Don your code worked after all, my mistake was to delete a carriage
return where there wasn't suppose to be one, after correcting that it worked
fine. So thanks for the help.

Dave, I'm still a bit confused about the worksheet vs. the general module
stuff but I'll try to figure that out later, thanks for the info.

Regards
Jean-Guy

"Dave Peterson" wrote:

Just to add to Don's response...

If your code was in a worksheet module, then Range("b4:B54") is unqualified--and
unqualified ranges in a worksheet module will refer to the sheet that owns the
code.

And since you can't select a range on a sheet that isn't active, your code blows
up.

This is different than how things work in a General module. The unqualified
ranges will refer to the activesheet.



pinmaster wrote:

Hi, does anyone know why this would cause an error?

ActiveWorkbook.Sheets("1st div").Select
Range("B5:B54").Select
Selection.Sort Key1:=Range("B5"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

error - Select method of range class failed

TIA
Jean-Guy


--

Dave Peterson

 
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
code not unique find latest date Barbara Wiseman Excel Discussion (Misc queries) 3 December 11th 05 08:50 AM
VLOOKUP for Zip Code Ranges JerseyJR Excel Worksheet Functions 2 September 6th 05 06:37 PM
Conform a total to a list of results? xmaveric Excel Discussion (Misc queries) 1 August 21st 05 07:22 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
close form code tkaplan Excel Discussion (Misc queries) 1 June 3rd 05 10:49 PM


All times are GMT +1. The time now is 01:03 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"