ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   why error for activate method (https://www.excelbanter.com/excel-programming/285108-why-error-activate-method.html)

Young-Hwan Choi

why error for activate method
 
Hi. colo.

For some reason, I thought the code had been worked fine.
After I went over my previous macros, I realized, strange enlugh, that this
was the first time I used this type of a code. And, I still don't understand
why it's not possible. It's pretty simple...

Anyway, I really appreciate your explanation and the Goto code.

thank you.

regards,


"Colo" wrote in message
...
Hi Young-Hwan, :)

You need activate Sheets(2) before activate/select the Range of Sheets(2).
So the code would be...

'--CODE--
Sheets(2).Select
Range("A1").Select 'Activate
'--

Or simply you can use this one.

'--CODE--
Application.Goto Sheets(2).Range("A1")
'--


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


"Young-Hwan Choi" wrote in message
...
Current activesheet is sheets(1).

Sheets(2).Range("A1").Activate

The code above gives an error saying that
Run time error:1004
Activate method of range class failed.

The "activate" method works fine when I am in the same worksheet.
Say, when I am in sheets(2) and use Sheets(2).Range("A1").Activate, then

it
works.
(None of the sheets is chartsheet.)

Is it normal? I thought it worked fine....







Young-Hwan Choi

why error for activate method
 
Current activesheet is sheets(1).

Sheets(2).Range("A1").Activate

The code above gives an error saying that
Run time error:1004
Activate method of range class failed.

The "activate" method works fine when I am in the same worksheet.
Say, when I am in sheets(2) and use Sheets(2).Range("A1").Activate, then it
works.
(None of the sheets is chartsheet.)

Is it normal? I thought it worked fine....




Colo

why error for activate method
 
Hi Young-Hwan, :)

You need activate Sheets(2) before activate/select the Range of Sheets(2).
So the code would be...

'--CODE--
Sheets(2).Select
Range("A1").Select 'Activate
'--

Or simply you can use this one.

'--CODE--
Application.Goto Sheets(2).Range("A1")
'--


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


"Young-Hwan Choi" wrote in message
...
Current activesheet is sheets(1).

Sheets(2).Range("A1").Activate

The code above gives an error saying that
Run time error:1004
Activate method of range class failed.

The "activate" method works fine when I am in the same worksheet.
Say, when I am in sheets(2) and use Sheets(2).Range("A1").Activate, then

it
works.
(None of the sheets is chartsheet.)

Is it normal? I thought it worked fine....






All times are GMT +1. The time now is 10:39 PM.

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