Results 1 to 9 of 9

Runtime Error '91' Object variable or With Block variable not set.

Threaded View

  1. #1
    Registered User
    Join Date
    02-09-2007
    Posts
    39

    Runtime Error '91' Object variable or With Block variable not set.

    Hello,

    Thanks for helping.

    I'm getting a
    Runtime Error '91'
    Object variable or With Block variable not set.
    when I run a button that creates a pie chart from a set of data:

    When I hit debug, this is what highlights:
    ActiveChart.ChartType = xlPie

    Sub Chart_Earnings() 'Pie chart for earnings
    
    Dim Sheetname As String
    Sheetname = ActiveSheet.Name
    
    Call DeleteCharts
        Range("J21,A1:A6,C1:C6").Select
        Range("C6").Activate
        Charts.Add
        ActiveChart.ChartType = xlPie
        ActiveChart.SetSourceData Source:=Sheets(Sheetname).Range("A1:A6,C1:C6"), _
            PlotBy:=xlColumns
        ActiveChart.Location Where:=xlLocationAsObject, Name:=Sheetname
        ActiveChart.HasLegend = True
        ActiveChart.Legend.Select
        Selection.Position = xlRight
    
    End Sub
    Do you have any idea what is wrong?

    Thank you.
    Last edited by pink; 02-17-2009 at 03:29 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