Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default How to use the "Range" object

Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default How to use the "Range" object

Jeff,

It may be that sheet "linforce" isn't the active sheet at the time. Every sheet has
selected cells, and an active (the white) cell, but you have to explicitly activate the
sheet containing the cell you wish to select. I think the Range("A1") doesn't fail because
it selects A1 of the active sheet, whatever it happens to be.
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeyl.com
-----------------------------------------------------------------------
"Jeff" wrote in message
...
Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 419
Default How to use the "Range" object

Jeff,

I don't know for sure, but I don't think you can select a cell on a sheet
that is not active. Because you have the range qualified with a sheet, I'm
guessing that the Iinforce sheet is not active.

Activate the sheet first, then select the cell.

Set tRange = Sheets("Iinforce").Range("A1")
Sheets("Iinforce").Activate
tRange.Select

See if that will work.

HTH,

Conan




"Jeff" wrote in message
...
Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default How to use the "Range" object

I tried

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Activate

also but that didnt work.


"Earl Kiosterud" wrote:

Jeff,

It may be that sheet "linforce" isn't the active sheet at the time. Every sheet has
selected cells, and an active (the white) cell, but you have to explicitly activate the
sheet containing the cell you wish to select. I think the Range("A1") doesn't fail because
it selects A1 of the active sheet, whatever it happens to be.
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeyl.com
-----------------------------------------------------------------------
"Jeff" wrote in message
...
Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default How to use the "Range" object

Jeff,

Also, make sure that you've dimmed tRange as a Range object.

Dim tRange as Range
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeyl.com
-----------------------------------------------------------------------
"Earl Kiosterud" wrote in message
...
Jeff,

It may be that sheet "linforce" isn't the active sheet at the time. Every sheet has
selected cells, and an active (the white) cell, but you have to explicitly activate the
sheet containing the cell you wish to select. I think the Range("A1") doesn't fail
because it selects A1 of the active sheet, whatever it happens to be.
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeyl.com
-----------------------------------------------------------------------
"Jeff" wrote in message
...
Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to use the "Range" object

with sheets("iinforce")
.select
set trange = .range("a1")
trange.select
end with

You can only select a range on the activesheet.

Another alternative:
Set tRange = Sheets("Iinforce").Range("A1")
application.goto tRange ', scroll:=true '????


Jeff wrote:

Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default How to use the "Range" object

Jeff,

The issue is which sheet is active at the time you try to activate or select tRange.. It
must be linforce" for it to work.

Dim tRange As Range

Set tRange = Sheets("linforce").Range("A1")
Sheets("linforce").Activate
tRange.Activate

--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeyl.com
-----------------------------------------------------------------------
"Jeff" wrote in message
...
I tried

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Activate

also but that didnt work.


"Earl Kiosterud" wrote:

Jeff,

It may be that sheet "linforce" isn't the active sheet at the time. Every sheet has
selected cells, and an active (the white) cell, but you have to explicitly activate the
sheet containing the cell you wish to select. I think the Range("A1") doesn't fail
because
it selects A1 of the active sheet, whatever it happens to be.
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeyl.com
-----------------------------------------------------------------------
"Jeff" wrote in message
...
Hi,

I was trying to copy stuff but I am getting an error.

Set tRange = Sheets("Iinforce").Range("A1")
tRange.Select

Error = "Selection method of range class failed"

Why is this an error when you can legally tye Range("A1").select?
Isn't my code the same thing?

Thanks for your help







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
cannot insert rows -error message "cannot shift object off sheet" robwan Excel Discussion (Misc queries) 1 November 10th 07 03:01 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


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