PC Review


Reply
Thread Tools Rate Thread

Chart vs Sheet distinction

 
 
Filo
Guest
Posts: n/a
 
      23rd Nov 2007
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 With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      23rd Nov 2007
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!

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      23rd Nov 2007
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" <(E-Mail Removed)> wrote in message
news:FB882D7F-15A4-4C9A-9A85-(E-Mail Removed)...
> 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 With Quote
 
DomThePom
Guest
Posts: n/a
 
      23rd Nov 2007
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!

 
Reply With Quote
 
Filo
Guest
Posts: n/a
 
      23rd Nov 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line and scatter chart in a single chart sheet db Microsoft Excel Charting 0 21st Sep 2010 12:08 AM
deciding minimum passing marks & distinction grade cliff Microsoft Access Queries 2 2nd Nov 2009 03:58 PM
To / Cc distinction when creating distribution lists lynnz09 Microsoft Outlook Contacts 2 4th Jun 2009 05:40 PM
Moving Pivot Chart Fields on a chart sheet =?Utf-8?B?c2hlcm9ib3Q=?= Microsoft Excel Charting 1 28th Apr 2006 10:08 PM
Distinction Between MM1 and MM2 Windows XP MovieMaker 1 12th Dec 2003 01:24 PM


Features
 

Advertising
 

Newsgroups
 


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