Results 1 to 5 of 5

IF statement is not working as expected?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    858

    Question IF statement is not working as expected?

    Hi All,
    If the "Summary" sheet contains a chart, the chart must be deleted when I click the ViewSummary button. The code below does not achieve this and I can't figure it out? Please help.

    Sub ViewSummary()
        Application.ScreenUpdating = False
        Worksheets("Summary").Activate
        If ActiveChart Is Nothing Then
            Range("B2").Select
            Application.ScreenUpdating = True
        Exit Sub
        End If
        ActiveSheet.ChartObjects.Delete
        Range("B2").Select
        Application.ScreenUpdating = True
    End Sub
    Thank You
    Last edited by Aland2929; 07-31-2009 at 02:03 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1