Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save chart (that's on a chart sheet) to html file? JoeFrench Charts and Charting in Excel 0 January 24th 08 12:11 PM
Check Activesheet for chart sheet or work sheet NSK Charts and Charting in Excel 1 July 17th 07 09:00 PM
Moving Pivot Chart Fields on a chart sheet sherobot Charts and Charting in Excel 1 April 28th 06 10:08 PM
Dynamic column chart - copying from Sheet to Sheet. Marko Pinteric Excel Discussion (Misc queries) 1 April 10th 06 12:57 PM
Dynamic column chart - copying from Sheet to Sheet. Marko Pinteric Charts and Charting in Excel 1 April 10th 06 12:57 PM


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"