View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default How to find the type of Sheet in Excel.Workbook.sheets collection

"Raj" wrote in message
m...
Hi,

How can I find out what type of sheet ( Chart, Dialog, worksheet ) is
present in Excel workbook.Sheets collection. I need to perform two
different operations based on the type.


Hi Raj,

Here's one way:

Dim objSheet As Object
For Each objSheet In ActiveWorkbook.Sheets
If TypeOf objSheet Is Excel.Worksheet Then
''' It's a worksheet.
ElseIf TypeOf objSheet Is Excel.Chart Then
''' It's a Chart sheet.
ElseIf TypeOf objSheet Is Excel.DialogSheet Then
''' It's a DialogSheet.
End If
Next objSheet

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *