LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Error 1004, "select method of range class failed"

Hi paritoshmehta ,

It's hard to say without seeing the code. But most likely, the active
worksheet is not the one on which you're trying to select cells. That will
cause a runtime error.

To solve it, you have a few options:

1) Don't select cells. Most (almost all) actions can be performed without
changing the current selection. For example, instead of doing this:

Sheets("Sheet1").Select
Range("A1").Select
MsgBox ActiveCell.Value

you could do this:

MsgBox Sheets("Sheet1").Range("A1").Value

Besides being faster, the second method doesn't change the user's active
selection.

2) If you must select cells, try the GoTo method instead:

Application.GoTo Sheets("Sheet1").Range("C1:D10")

This will not fail if the active worksheet is not Sheet1.


It's also possible that you would get this error if you are running code
from a CommandButton placed on a worksheet - if that's the case, try setting
the TakeFocusOnClick property of the button to False.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Hi

I am getting this error 1004 "select method of range class failed"
when my macro tries selecting some cells in a sheet,

can someonw help about the possible causes!!!


---
Message posted from http://www.ExcelForum.com/


 
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" Error Ayo Excel Discussion (Misc queries) 3 September 2nd 08 07:58 PM
Run-Time error '1004' : Select method of Range class failed [email protected] Excel Discussion (Misc queries) 3 March 9th 07 01:36 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
Runtime Error "1004" Select Method of Range Class Failed Stephen[_7_] Excel Programming 4 April 10th 04 06:28 AM
error 1004 Select method of Range class failed J.E. McGimpsey Excel Programming 1 September 12th 03 07:42 PM


All times are GMT +1. The time now is 11:47 AM.

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"