![]() |
Chart vs Sheet distinction
Hello-
I would like a program to run only if the activeworksheet is not a chartsheet. Can you please help? I basically need something like: If activeworksheet is a chart then exit sub else ....code... end if Thank you! |
Chart vs Sheet distinction
One way...
Dim wks As Worksheet On Error Resume Next Set wks = ActiveSheet On Error GoTo 0 If wks Is Nothing Then MsgBox "ChartSheet" End If -- HTH... Jim Thomlinson "Filo" wrote: Hello- I would like a program to run only if the activeworksheet is not a chartsheet. Can you please help? I basically need something like: If activeworksheet is a chart then exit sub else ...code... end if Thank you! |
Chart vs Sheet distinction
Or...
If Typename(ActiveSheet) = "Worksheet" Then ' do your stuff End If - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Filo" wrote in message ... Hello- I would like a program to run only if the activeworksheet is not a chartsheet. Can you please help? I basically need something like: If activeworksheet is a chart then exit sub else ...code... end if Thank you! |
Chart vs Sheet distinction
or
Function IsActiveSheetChart() As Boolean Dim c As Chart On Error Resume Next Set c = ActiveWorkbook.Charts(ActiveSheet.Name) If Err = 0 Then IsActiveSheetChart = True Else IsActiveSheetChart = False End If On Error GoTo 0 Set c = Nothing End Function "Filo" wrote: Hello- I would like a program to run only if the activeworksheet is not a chartsheet. Can you please help? I basically need something like: If activeworksheet is a chart then exit sub else ...code... end if Thank you! |
Chart vs Sheet distinction
Thank you All. This was very helpful!!
"Filo" wrote: Hello- I would like a program to run only if the activeworksheet is not a chartsheet. Can you please help? I basically need something like: If activeworksheet is a chart then exit sub else ...code... end if Thank you! |
All times are GMT +1. The time now is 03:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com