PC Review


Reply
Thread Tools Rate Thread

Activation inheritance

 
 
=?Utf-8?B?TWF0cyBTYW1zb24=?=
Guest
Posts: n/a
 
      1st Feb 2007
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 With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      1st Feb 2007
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" <(E-Mail Removed)> wrote in message
news:4DC1CC53-601B-417D-AEAD-(E-Mail Removed)...
> 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 With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      1st Feb 2007
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" <(E-Mail Removed)> wrote in message
news:4DC1CC53-601B-417D-AEAD-(E-Mail Removed)...
> 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 With Quote
 
Peter T
Guest
Posts: n/a
 
      1st Feb 2007
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" <(E-Mail Removed)> wrote in message
news:4DC1CC53-601B-417D-AEAD-(E-Mail Removed)...
> 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 With Quote
 
=?Utf-8?B?TWF0cyBTYW1zb24=?=
Guest
Posts: n/a
 
      1st Feb 2007
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" <(E-Mail Removed)> wrote in message
> news:4DC1CC53-601B-417D-AEAD-(E-Mail Removed)...
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Vista product key activation. Is it a 1 to 1 activation? =?Utf-8?B?anc=?= Windows Vista Installation 14 9th May 2010 04:58 PM
activation failure, specific question re: activation work-around =?Utf-8?B?SmltMTAzMTQ0?= Windows Vista Installation 5 19th Sep 2007 03:58 PM
Win XP HE - Product Activation - recurring activation on start up =?Utf-8?B?RWRnYXJB?= Windows XP New Users 5 4th Nov 2004 12:56 AM
XP Home activation problem - cannot complete activation Harley Windows XP Setup 1 27th Mar 2004 09:17 PM
Activation Request fails, even after Activation Wayne Windows XP General 2 27th Jan 2004 05:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:49 PM.