Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Select method of Range Class failed

What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Select method of Range Class failed

You can only select a cell on an active worksheet. If the sheet is not active
then the code will crash... unless you use application.goto something like
this...

application.goto Worksheets("working data").Range("A" & rowx & ": K" & rowx)

or

with Worksheets("working data")
..select
..Range("A" & rowx & ": K" & rowx).Select
end with

--
HTH...

Jim Thomlinson


"Eric @ BP-EVV" wrote:

What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Select method of Range Class failed

Not sure what you mean by "You can only select a cell on an active worksheet.
If the sheet is not active then the code will crash" Jim. I can get data from
any sheet i want, active or not without a select. As long as you include the
sheet name or index.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Jim Thomlinson" wrote:

You can only select a cell on an active worksheet. If the sheet is not active
then the code will crash... unless you use application.goto something like
this...

application.goto Worksheets("working data").Range("A" & rowx & ": K" & rowx)

or

with Worksheets("working data")
.select
.Range("A" & rowx & ": K" & rowx).Select
end with

--
HTH...

Jim Thomlinson


"Eric @ BP-EVV" wrote:

What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Select method of Range Class failed

Yes you can get the value of the cell but you can not select the cell. The
select method of a range fails if the worksheet that the range is on is not
the active sheet. Run this code on a new worksbook

sub test
sheets("Sheet2").select
sheets("Sheet2").range("C3").select
msgbox "OK to here... but get ready to crash"
sheets("Sheet1").range("C3").select
end sub

--
HTH...

Jim Thomlinson


"John Bundy" wrote:

Not sure what you mean by "You can only select a cell on an active worksheet.
If the sheet is not active then the code will crash" Jim. I can get data from
any sheet i want, active or not without a select. As long as you include the
sheet name or index.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Jim Thomlinson" wrote:

You can only select a cell on an active worksheet. If the sheet is not active
then the code will crash... unless you use application.goto something like
this...

application.goto Worksheets("working data").Range("A" & rowx & ": K" & rowx)

or

with Worksheets("working data")
.select
.Range("A" & rowx & ": K" & rowx).Select
end with

--
HTH...

Jim Thomlinson


"Eric @ BP-EVV" wrote:

What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Select method of Range Class failed

I gotcha, i guess i didn't look close enough to see actually selecting the
cells, too long at work i guess!
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Jim Thomlinson" wrote:

Yes you can get the value of the cell but you can not select the cell. The
select method of a range fails if the worksheet that the range is on is not
the active sheet. Run this code on a new worksbook

sub test
sheets("Sheet2").select
sheets("Sheet2").range("C3").select
msgbox "OK to here... but get ready to crash"
sheets("Sheet1").range("C3").select
end sub

--
HTH...

Jim Thomlinson


"John Bundy" wrote:

Not sure what you mean by "You can only select a cell on an active worksheet.
If the sheet is not active then the code will crash" Jim. I can get data from
any sheet i want, active or not without a select. As long as you include the
sheet name or index.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Jim Thomlinson" wrote:

You can only select a cell on an active worksheet. If the sheet is not active
then the code will crash... unless you use application.goto something like
this...

application.goto Worksheets("working data").Range("A" & rowx & ": K" & rowx)

or

with Worksheets("working data")
.select
.Range("A" & rowx & ": K" & rowx).Select
end with

--
HTH...

Jim Thomlinson


"Eric @ BP-EVV" wrote:

What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Select method of Range Class failed

The obvious:

What is the value of rowx at the time this statement is executed? Also
what is rowx declared as?
Is there a worksheet named "working data"?

--JP

On Aug 13, 4:37*pm, Eric @ BP-EVV
wrote:
What's wrong with the following statement that would cause the error: *Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Select method of Range Class failed

Thanks to the three of you for some interesting banter....I got the issue
resolved....perhaps it was that rowx wasn't being properly set as JP implied,
perhaps it was something else....I hate to say I don't recall what I did to
fix it but it works good now. (Too much time at work for me too !)


"JP" wrote:

The obvious:

What is the value of rowx at the time this statement is executed? Also
what is rowx declared as?
Is there a worksheet named "working data"?

--JP

On Aug 13, 4:37 pm, Eric @ BP-EVV
wrote:
What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Select method of Range Class failed

If there is a way you can execute your code without doing any
"selecting", it would make the code faster and less error prone.

--JP

On Aug 14, 8:53*am, Eric @ BP-EVV
wrote:
Thanks to the three of you for some interesting banter....I got the issue
resolved....perhaps it was that rowx wasn't being properly set as JP implied,
perhaps it was something else....I hate to say I don't recall what I did to
fix it but it works good now. (Too much time at work for me too !)



"JP" wrote:
The obvious:


What is the value of rowx at the time this statement is executed? Also
what is rowx declared as?
Is there a worksheet named "working data"?


--JP


On Aug 13, 4:37 pm, Eric @ BP-EVV
wrote:
What's wrong with the following statement that would cause the error: *Select
method of Range Class failed ??


Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select


Thanks !- Hide quoted text -


- Show quoted text -


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Select method of Range Class failed

That line works perfectly for me, what value is rowx set to?
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Eric @ BP-EVV" wrote:

What's wrong with the following statement that would cause the error: Select
method of Range Class failed ??

Worksheets("working data").Range("A" & rowx & ": K" & rowx).Select

Thanks !

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
Select Method of Range Class Failed DKS Excel Programming 3 January 31st 08 12:11 AM
Select Method of Range Class Failed [email protected] Excel Programming 4 June 21st 07 03:07 PM
Select method of range class failed sa02000[_5_] Excel Programming 5 October 5th 05 09:10 AM
Select method of Range class failed - but why??? Orion[_2_] Excel Programming 3 December 21st 04 03:28 PM
select method of range class failed Joseph[_38_] Excel Programming 1 September 28th 04 03:21 PM


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