ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheets or Worksheets (https://www.excelbanter.com/excel-programming/330367-sheets-worksheets.html)

Piranha

Sheets or Worksheets
 

Hi,
They both select all the sheets in a workbbok.
Whats the difference in these two statements?
Why Dim wkSht?
Why Sheets or Worksheets?

For Each Sheet In ActiveWorkbook.Sheets
Sheet.~~~~~~~

or

Dim wkSht As Worksheet
For Each wkSht In ActiveWorkbook.Worksheets
With wkSht

Thank you
Dave


--
Piranha
------------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435
View this thread: http://www.excelforum.com/showthread...hreadid=374763


JE McGimpsey

Sheets or Worksheets
 
The Worksheets collection contains only worksheets. The Sheets
collection contains worksheets and chart sheets.


In article ,
Piranha wrote:

Hi,
They both select all the sheets in a workbbok.
Whats the difference in these two statements?
Why Dim wkSht?
Why Sheets or Worksheets?

For Each Sheet In ActiveWorkbook.Sheets
Sheet.~~~~~~~

or

Dim wkSht As Worksheet
For Each wkSht In ActiveWorkbook.Worksheets
With wkSht

Thank you
Dave


Piranha[_2_]

Sheets or Worksheets
 

JE McGimpsey,
Thank you very much. That clears up that question for me.
All i can get to help me understand, is a good thing.
Thanks again
Dave

JE McGimpsey Wrote:
The Worksheets collection contains only worksheets. The Sheets
collection contains worksheets and chart sheets.


In article ,
Piranha wrote:

Hi,
They both select all the sheets in a workbbok.
Whats the difference in these two statements?
Why Dim wkSht?
Why Sheets or Worksheets?

For Each Sheet In ActiveWorkbook.Sheets
Sheet.~~~~~~~

or

Dim wkSht As Worksheet
For Each wkSht In ActiveWorkbook.Worksheets
With wkSht

Thank you
Dav


--
Piranh
-----------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...fo&userid=2043
View this thread: http://www.excelforum.com/showthread.php?threadid=37476



All times are GMT +1. The time now is 05:38 AM.

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