#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Range error

I have an error occuring when I try to run this simple bit of code. The code
is:

Sheets("Name").select
Range("A2:D26").select

The code is started on Sheet1 and it does change to "Name" but it says :
select method of Range class failed.
The code is assigned to a button.

Any ideas what I have done wrong
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Range error

I'd probably get rid of the SELECT altogether

Dim myWS as Worksheet
Dim myRange as range

On Error resume next
Set myWS = Sheets("Name")
On error goto 0
if myWS is nothing then
MsgBox("There is no worksheet 'Name'.")
End
end if

Set myRange = myWS.Range("A2:D26")

Do all of your action on myRange.
--
HTH,
Barb Reinhardt



"Murray" wrote:

I have an error occuring when I try to run this simple bit of code. The code
is:

Sheets("Name").select
Range("A2:D26").select

The code is started on Sheet1 and it does change to "Name" but it says :
select method of Range class failed.
The code is assigned to a button.

Any ideas what I have done wrong
Thanks in advance

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
Error:Subscript out of range Jay Excel Discussion (Misc queries) 1 April 10th 08 10:25 PM
Range error Jennifer Excel Discussion (Misc queries) 1 November 7th 07 11:45 AM
Named range error Antman Excel Discussion (Misc queries) 3 July 13th 06 02:33 AM
Error 0x800A03EC trying to set range value mdengler New Users to Excel 2 March 1st 06 01:22 PM
out of range error Matilda New Users to Excel 9 September 18th 05 12:11 AM


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