Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Activation inheritance

I'm a little bit confused that the following does not seem to be valid.
Copy from another active Workbook and
Workbooks("A").Worksheets("B"). Range("Goal"). Activate
Paste....
If Worksheets("A") was the active sheet before switching to another WB then
the code returns to the A-sheet and give me the error 1004 as it cannot find
the
range "Goal" in this sheet.

Is it really necessary to acivate each part individually?
Workbooks("A").Activate
Worksheets("B").Activate
Range("Goal"). Activate

Why? It doesn't seem to be logic!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Activation inheritance

Mats,
Yes, you cannot .Activate/.Select an object unless its .Parent is active. So
you need to step through like that.
Or
Application.Goto Workbooks(2).Worksheets(1).Range("A2")

However, for most of Excel's functionality, you do not need to .activate the
object(s) in order to use them. Depends what you are doing.

NickHK

"Mats Samson" wrote in message
...
I'm a little bit confused that the following does not seem to be valid.
Copy from another active Workbook and
Workbooks("A").Worksheets("B"). Range("Goal"). Activate
Paste....
If Worksheets("A") was the active sheet before switching to another WB

then
the code returns to the A-sheet and give me the error 1004 as it cannot

find
the
range "Goal" in this sheet.

Is it really necessary to acivate each part individually?
Workbooks("A").Activate
Worksheets("B").Activate
Range("Goal"). Activate

Why? It doesn't seem to be logic!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Activation inheritance

You need to activate separately, not all the way but sheet and range

Workbooks("A").Worksheets("B").Activate
Range("Goal"). Activate

I agree with you, but that is how it is.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mats Samson" wrote in message
...
I'm a little bit confused that the following does not seem to be valid.
Copy from another active Workbook and
Workbooks("A").Worksheets("B"). Range("Goal"). Activate
Paste....
If Worksheets("A") was the active sheet before switching to another WB

then
the code returns to the A-sheet and give me the error 1004 as it cannot

find
the
range "Goal" in this sheet.

Is it really necessary to acivate each part individually?
Workbooks("A").Activate
Worksheets("B").Activate
Range("Goal"). Activate

Why? It doesn't seem to be logic!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Activation inheritance

Nick & Bob have explained about Activate. It's not clear what you are trying
to do other than you mention Copy/Paste. For that you don't need select or
activate -

rngSource.Copy rngDest

Set the two ranges as required, qualifying them back to the appropriate
workbook and sheet.

If the two ranges are not same size at least one should refer to a single
cell.

Regards,
Peter T

"Mats Samson" wrote in message
...
I'm a little bit confused that the following does not seem to be valid.
Copy from another active Workbook and
Workbooks("A").Worksheets("B"). Range("Goal"). Activate
Paste....
If Worksheets("A") was the active sheet before switching to another WB

then
the code returns to the A-sheet and give me the error 1004 as it cannot

find
the
range "Goal" in this sheet.

Is it really necessary to acivate each part individually?
Workbooks("A").Activate
Worksheets("B").Activate
Range("Goal"). Activate

Why? It doesn't seem to be logic!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Activation inheritance

Thank you for quick response, it's alright!
To Peter: The copy and paste ranges are not important in my case, that works
fine.
The whole story is whether the parent workbook and worksheet also inherits
the activation, i.e. also become active when I select a range in the
worksheet.
Obviously they don't.

"Peter T" wrote:

Nick & Bob have explained about Activate. It's not clear what you are trying
to do other than you mention Copy/Paste. For that you don't need select or
activate -

rngSource.Copy rngDest

Set the two ranges as required, qualifying them back to the appropriate
workbook and sheet.

If the two ranges are not same size at least one should refer to a single
cell.

Regards,
Peter T

"Mats Samson" wrote in message
...
I'm a little bit confused that the following does not seem to be valid.
Copy from another active Workbook and
Workbooks("A").Worksheets("B"). Range("Goal"). Activate
Paste....
If Worksheets("A") was the active sheet before switching to another WB

then
the code returns to the A-sheet and give me the error 1004 as it cannot

find
the
range "Goal" in this sheet.

Is it really necessary to acivate each part individually?
Workbooks("A").Activate
Worksheets("B").Activate
Range("Goal"). Activate

Why? It doesn't seem to be logic!




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
activation key LewisT Excel Discussion (Misc queries) 2 March 24th 10 05:27 AM
inheritance Bernard Bourée Excel Programming 4 August 18th 06 06:17 PM
why doesn't microsoft excel support inheritance A. Gilligan Excel Programming 1 December 15th 05 01:50 AM
inheritance module @ndy Excel Programming 1 January 11th 05 04:17 PM
Inheritance of references MrT Excel Programming 1 January 11th 05 11:32 AM


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