ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select a range in an unselected cell (https://www.excelbanter.com/excel-programming/396550-select-range-unselected-cell.html)

elaine

Select a range in an unselected cell
 
Can anyone tell me why doesn't work:

Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Sele ct

when this does:
Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Dele te shift:=xlUp

I just want to select a cell on a different sheet!

it keeps giving me this error code:
Runtime error '1004':
Select method of Range class failed

I just want to select a cell on a different sheet!
I cant even get a basic reference like:

Worksheets("Keyword").Range("A1").Select

to work unless I am already on the "Keyword" worksheet.

Thanks.


No Name

Select a range in an unselected cell
 
Activate the sheet first

With Worksheets("Keyword")
.Visible = True
.Activate
.Range("A1").Select
End With

"elaine" wrote in message
ps.com...
Can anyone tell me why doesn't work:

Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Sele ct

when this does:
Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Dele te shift:=xlUp

I just want to select a cell on a different sheet!

it keeps giving me this error code:
Runtime error '1004':
Select method of Range class failed

I just want to select a cell on a different sheet!
I cant even get a basic reference like:

Worksheets("Keyword").Range("A1").Select

to work unless I am already on the "Keyword" worksheet.

Thanks.




elaine

Select a range in an unselected cell
 
How do i get this to work? sorry for all the questions

the selection is on a currently selected worksheet that isn't "word
list"

Selection.Copy Destination:=Sheets("Word List").ActiveCell



Chip Pearson

Select a range in an unselected cell
 
Elaine,

You cannot Select a cell if the worksheet containing that cell is not
active. You must select the sheet first, then the cell. E.g.,

Worksheets("Sheet2").Select
Range("A10").Select

or

Dim Rng As Range
Set Rng= Worksheets("Sheet1").Range("A10")
Rng.Worksheet.Select
Rng.Select

As an alternative, you can use Application.Goto:

Dim Rng As Range
Set Rng = Worksheets("Sheet1").Range("A10")
Application.Goto Rng, True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"elaine" wrote in message
ps.com...
Can anyone tell me why doesn't work:

Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Sele ct

when this does:
Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Dele te shift:=xlUp

I just want to select a cell on a different sheet!

it keeps giving me this error code:
Runtime error '1004':
Select method of Range class failed

I just want to select a cell on a different sheet!
I cant even get a basic reference like:

Worksheets("Keyword").Range("A1").Select

to work unless I am already on the "Keyword" worksheet.

Thanks.



No Name

Select a range in an unselected cell
 
In the first example you are selecting something. In the 2nd, you are not.
To select something, the sheet must be active.

No need to select the range anyway. I think you want something like:

With WorkSheets("Word Analysis")
.Range(.Range("A2"), .Range("A2").End(xlDown)).Copy
Destination:=WorkSheets("??").Range("A2")
End With



"elaine" wrote in message
ps.com...
Can anyone tell me why doesn't work:

Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Sele ct

when this does:
Range(Sheets("Word Analysis").Range("A2"), Sheets("KeyWord
Analysis").Range("A2").End(xlDown)).EntireRow.Dele te shift:=xlUp

I just want to select a cell on a different sheet!

it keeps giving me this error code:
Runtime error '1004':
Select method of Range class failed

I just want to select a cell on a different sheet!
I cant even get a basic reference like:

Worksheets("Keyword").Range("A1").Select

to work unless I am already on the "Keyword" worksheet.

Thanks.





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com