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