ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Sheet" versus "Worksheet" (https://www.excelbanter.com/excel-programming/281998-sheet-versus-worksheet.html)

Chuck Taylor

"Sheet" versus "Worksheet"
 
When I need to switch from one worksheet to the other, I usually use
code like:

Worksheets("Sheet1").Select (or Activate)

But sometimes this just doesn't work unless I change it to:

Sheets("Sheet1").Select

Just for the sake of curosity, what's the difference between "Sheets"
and "Worksheets"? Excel help file isn't much help.

J

Tom Ogilvy

"Sheet" versus "Worksheet"
 
Excel has many types of sheet
Chart
Worksheets
xl4Macro Sheet
xl4 International Macro Sheet
DialogSheet
and in xl95 and xl5, Module sheets

I have never seen Sheets work where Worksheets doesn't if I am trying to
select a worksheet.



--
Regards,
Tom Ogilvy


Chuck Taylor wrote in message
...
When I need to switch from one worksheet to the other, I usually use
code like:

Worksheets("Sheet1").Select (or Activate)

But sometimes this just doesn't work unless I change it to:

Sheets("Sheet1").Select

Just for the sake of curosity, what's the difference between "Sheets"
and "Worksheets"? Excel help file isn't much help.

J




Alan

"Sheet" versus "Worksheet"
 

"Tom Ogilvy" wrote in message
...
Excel has many types of sheet
Chart
Worksheets
xl4Macro Sheet
xl4 International Macro Sheet
DialogSheet
and in xl95 and xl5, Module sheets

I have never seen Sheets work where Worksheets doesn't if I am

trying to
select a worksheet.



--
Regards,
Tom Ogilvy


This might explain why it doesn't always / ever work for a chart sheet
though?

I guess you are saying that Excel sees them as unique or separate
objects?

Alan.



Tom Ogilvy

"Sheet" versus "Worksheet"
 
Sure - they are separate objects

you can't
Dim sh as sheet

You have to do
Dim sh as Object
for each sh in sheets



dim ch as Chart
for each sh in Charts


dim ws as Worksheet
for each ws in Worksheets


I don't know what you mean by doesn't work.

--
Regards,
Tom Ogilvy



Alan wrote in message
...

"Tom Ogilvy" wrote in message
...
Excel has many types of sheet
Chart
Worksheets
xl4Macro Sheet
xl4 International Macro Sheet
DialogSheet
and in xl95 and xl5, Module sheets

I have never seen Sheets work where Worksheets doesn't if I am

trying to
select a worksheet.



--
Regards,
Tom Ogilvy


This might explain why it doesn't always / ever work for a chart sheet
though?

I guess you are saying that Excel sees them as unique or separate
objects?

Alan.






All times are GMT +1. The time now is 04:16 PM.

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