Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Select a sheet and activate a Window

Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Select a sheet and activate a Window

Hari,

You can activate a sheet as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Select a sheet and activate a Window

Hi Bob,

I tried that previously and got a error. When i changed it to -- select --
it worked. So, I thought that may be sheets can only be selected.
I tried with -- Activate -- now and its working perfectly fine. (Dunno why I
had the problem in the first place.)

You can activate a sheet as well.

Anyway, then whats the difference between select and activate? Especially
when I record a macro and click on some other workbook I get --
Windows("hari").activate -- and if I click on some other Worksheet I get --
Sheets("sheet1").select. So, what causes VB to assign activate and select in
a selective manner.

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hari,

You can activate a sheet as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Select a sheet and activate a Window

Hi Bob,

I have been able to *reproduce* the problem. I have the code below which
fails.

ThisWorkbook.Worksheets("basesheet").select

When I change it to

ThisWorkbook.Worksheets("basesheet").Activate

Its fine.

Now some background... Suppose during code execution I'm on basesheet (part
of ThisWorkbook) and due to some Loop I navigate to some other WORKBOOK and
when I want to come back to the basesheet within ThisworkBook I use the --
..Select code -- and it fails, but if I use the activate code it doesnt fail.

What I can see from above is that (pls correct me if am wrong) if I try to
activate a worksheet within some workbook which was active the last time the
workbook was worked upon then probably select method fails. Is that right?

Thanks a lot,
Hari
India


"Hari Prasadh" wrote in message
...
Hi Bob,

I tried that previously and got a error. When i changed it to -- select --
it worked. So, I thought that may be sheets can only be selected.
I tried with -- Activate -- now and its working perfectly fine. (Dunno why
I had the problem in the first place.)

You can activate a sheet as well.

Anyway, then whats the difference between select and activate? Especially
when I record a macro and click on some other workbook I get --
Windows("hari").activate -- and if I click on some other Worksheet I
get -- Sheets("sheet1").select. So, what causes VB to assign activate and
select in a selective manner.

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hari,

You can activate a sheet as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Select a sheet and activate a Window

Hi Hari,

This is being caused because a workbook object (ThisWorkbook is a special
Workbook object), like the Window object, can be activated but it cannot be
selected. That is why

ThisWorkbook.Worksheets("basesheet").Activate

works fine and

ThisWorkbook.Worksheets("basesheet").Select

doesn't, because it is failing on the workbook, not the worksheet.

To demonstrate more clearly, this works fine

ThisWorkbook.Activate
Worksheets("basesheet").Activate

as does this

ThisWorkbook.Activate
Worksheets("basesheet").Select

whereas this fails in the first line

ThisWorkbook.Select
Worksheets("basesheet").Select

BTW, whereabouts in India do you live? Not Bangalore :-)?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi Bob,

I have been able to *reproduce* the problem. I have the code below which
fails.

ThisWorkbook.Worksheets("basesheet").select

When I change it to

ThisWorkbook.Worksheets("basesheet").Activate

Its fine.

Now some background... Suppose during code execution I'm on basesheet

(part
of ThisWorkbook) and due to some Loop I navigate to some other WORKBOOK

and
when I want to come back to the basesheet within ThisworkBook I use the --
.Select code -- and it fails, but if I use the activate code it doesnt

fail.

What I can see from above is that (pls correct me if am wrong) if I try to
activate a worksheet within some workbook which was active the last time

the
workbook was worked upon then probably select method fails. Is that right?

Thanks a lot,
Hari
India


"Hari Prasadh" wrote in message
...
Hi Bob,

I tried that previously and got a error. When i changed it to --

select --
it worked. So, I thought that may be sheets can only be selected.
I tried with -- Activate -- now and its working perfectly fine. (Dunno

why
I had the problem in the first place.)

You can activate a sheet as well.

Anyway, then whats the difference between select and activate?

Especially
when I record a macro and click on some other workbook I get --
Windows("hari").activate -- and if I click on some other Worksheet I
get -- Sheets("sheet1").select. So, what causes VB to assign activate

and
select in a selective manner.

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hari,

You can activate a sheet as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Select a sheet and activate a Window

Hi Bob,

Thnx for a explanatory reply.

I use excel to make my life easier (and yes I like it a lot). Not a
programmer by any chance. Im put up in Delhi. Do tell me if u ever come
here. Wud be happy to host you (and other problem solvers). But beware .. So
many doubts I have in excel that....

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hi Hari,

This is being caused because a workbook object (ThisWorkbook is a special
Workbook object), like the Window object, can be activated but it cannot
be
selected. That is why

ThisWorkbook.Worksheets("basesheet").Activate

works fine and

ThisWorkbook.Worksheets("basesheet").Select

doesn't, because it is failing on the workbook, not the worksheet.

To demonstrate more clearly, this works fine

ThisWorkbook.Activate
Worksheets("basesheet").Activate

as does this

ThisWorkbook.Activate
Worksheets("basesheet").Select

whereas this fails in the first line

ThisWorkbook.Select
Worksheets("basesheet").Select

BTW, whereabouts in India do you live? Not Bangalore :-)?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi Bob,

I have been able to *reproduce* the problem. I have the code below which
fails.

ThisWorkbook.Worksheets("basesheet").select

When I change it to

ThisWorkbook.Worksheets("basesheet").Activate

Its fine.

Now some background... Suppose during code execution I'm on basesheet

(part
of ThisWorkbook) and due to some Loop I navigate to some other WORKBOOK

and
when I want to come back to the basesheet within ThisworkBook I use
the --
.Select code -- and it fails, but if I use the activate code it doesnt

fail.

What I can see from above is that (pls correct me if am wrong) if I try
to
activate a worksheet within some workbook which was active the last time

the
workbook was worked upon then probably select method fails. Is that
right?

Thanks a lot,
Hari
India


"Hari Prasadh" wrote in message
...
Hi Bob,

I tried that previously and got a error. When i changed it to --

select --
it worked. So, I thought that may be sheets can only be selected.
I tried with -- Activate -- now and its working perfectly fine. (Dunno

why
I had the problem in the first place.)

You can activate a sheet as well.
Anyway, then whats the difference between select and activate?

Especially
when I record a macro and click on some other workbook I get --
Windows("hari").activate -- and if I click on some other Worksheet I
get -- Sheets("sheet1").select. So, what causes VB to assign activate

and
select in a selective manner.

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hari,

You can activate a sheet as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India












  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Select a sheet and activate a Window

Hari,

It would be worth the seeing all your problems to visit Delhi ;-).

We were going to go last year, on a tour (Delhi, Agra, Jaipur, etc.), but
Lynne decided that the travel was just too intense, every day very long
travels, so we went to Sri Lanka instead and did one week of culture, and
one of lazing. Had a great time, but were devastated by the Boxing Day news,
and especially to hear that the hotel that we stayed at had survived but was
very badly damaged, and the town of Kalatura has been devastated.

Regards

Bob

"Hari Prasadh" wrote in message
...
Hi Bob,

Thnx for a explanatory reply.

I use excel to make my life easier (and yes I like it a lot). Not a
programmer by any chance. Im put up in Delhi. Do tell me if u ever come
here. Wud be happy to host you (and other problem solvers). But beware ..

So
many doubts I have in excel that....

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hi Hari,

This is being caused because a workbook object (ThisWorkbook is a

special
Workbook object), like the Window object, can be activated but it cannot
be
selected. That is why

ThisWorkbook.Worksheets("basesheet").Activate

works fine and

ThisWorkbook.Worksheets("basesheet").Select

doesn't, because it is failing on the workbook, not the worksheet.

To demonstrate more clearly, this works fine

ThisWorkbook.Activate
Worksheets("basesheet").Activate

as does this

ThisWorkbook.Activate
Worksheets("basesheet").Select

whereas this fails in the first line

ThisWorkbook.Select
Worksheets("basesheet").Select

BTW, whereabouts in India do you live? Not Bangalore :-)?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi Bob,

I have been able to *reproduce* the problem. I have the code below

which
fails.

ThisWorkbook.Worksheets("basesheet").select

When I change it to

ThisWorkbook.Worksheets("basesheet").Activate

Its fine.

Now some background... Suppose during code execution I'm on basesheet

(part
of ThisWorkbook) and due to some Loop I navigate to some other WORKBOOK

and
when I want to come back to the basesheet within ThisworkBook I use
the --
.Select code -- and it fails, but if I use the activate code it doesnt

fail.

What I can see from above is that (pls correct me if am wrong) if I try
to
activate a worksheet within some workbook which was active the last

time
the
workbook was worked upon then probably select method fails. Is that
right?

Thanks a lot,
Hari
India


"Hari Prasadh" wrote in message
...
Hi Bob,

I tried that previously and got a error. When i changed it to --

select --
it worked. So, I thought that may be sheets can only be selected.
I tried with -- Activate -- now and its working perfectly fine.

(Dunno
why
I had the problem in the first place.)

You can activate a sheet as well.
Anyway, then whats the difference between select and activate?

Especially
when I record a macro and click on some other workbook I get --
Windows("hari").activate -- and if I click on some other Worksheet I
get -- Sheets("sheet1").select. So, what causes VB to assign

activate
and
select in a selective manner.

Thanks a lot,
Hari
India

"Bob Phillips" wrote in message
...
Hari,

You can activate a sheet as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Why do we Select a sheet but Activate a window.

(Above from the syntax writing point of view)

Thanks a lot,
Hari
India















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
Generic Window Activate Michael Excel Programming 3 March 4th 04 08:42 PM
Activate new window Robert Rosenberg[_2_] Excel Programming 0 December 30th 03 04:46 PM
Activate new window Tom Ogilvy Excel Programming 0 December 30th 03 04:37 PM
Activate Non-Excel Window Through VBA Mark Bigelow Excel Programming 1 September 3rd 03 07:37 PM
How to keep window + form activate together John Brash Excel Programming 1 July 24th 03 10:13 AM


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