Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 32

Thread: chart update problem help!!

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location

    Unhappy chart update problem help!!

    Can someone help!!!

    I have written this code to update a speedo style chart in my workbook,

    I also have a number of other charts on the same sheet, however when I enter data in one of the other charts. I get the following message " runtime error 1004 unable to get the chartobjects property of the worksheet class"

    (I am a beginner at writing vba code) and I am reaching for the headache tablets!!!



    Copy of code show below

    WORKBOOK SHEETCHANGE

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Application.ScreenUpdating = False

    ActiveSheet.ChartObjects("speedo").Activate

    ActiveChart.ChartGroups(1).FirstSliceAngle = ActiveSheet.Range("d42")

    Worksheets("Area Dashboard").Activate

    Range("a1").Select

    Application.ScreenUpdating = True

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post the workbook?

    What do you mean by ... when I enter data in one of the other charts...?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    I have other charts on the same page (non vba), when data is entered into them I get this mesage " runtime error 1004 unable to get the chartobjects property of the worksheet class"


  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Still don't get it. How do you enter data into charts? And without the workbook, it is very difficult to envisage.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    would you like me to send you the file?? ....is this allowed here??

  6. #6
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    only 300kb

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can post it here. Click the Go Advanced button, then on the new screen, scroll down a bit and you will see Manage Files, that will allow you to attach a file.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    cant see the advanced menu

  9. #9
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    file added
    Last edited by Markyr; 07-31-2008 at 11:04 PM.

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    What do I need to do to generate the error?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  11. #11
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    type in a value into the data sheet to alter any of the column graphs and you will receive the error message!!

  12. #12
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

    Application.ScreenUpdating = False

    With Worksheets("Area Dashboard")

    .Activate
    .ChartObjects("speedo").Activate
    ActiveChart.ChartGroups(1).FirstSliceAngle = .Range("D42").Value
    .Range("a1").Select
    End With

    Application.ScreenUpdating = True

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  13. #13
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    is that the answer??

  14. #14
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Yep!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  15. #15
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    so I just need to copy and paste the vba into the vba editor, sorry I am new to this!!

  16. #16
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Yes, just overtype what you copied from earlier.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  17. #17
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    Thanks everso!!!

    It works brilliantly, I bow to your knowledge sir, I am new to this, do you know of any good beginner courses on vba, or did you learn by trial and error??


  18. #18
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I am afraid I am not the person to recommend an approach/methodology to you. I am an old time IT bod, who is so sad that he even bought Apple II's, BBC, early IBM to play with these things in his own time. So when I came to Excel, and much later, to VBA, I was already an old-timer at the programming game. Plus, I used VB befoe VBA, so I had a head-start.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  19. #19
    VBAX Regular
    Joined
    Jul 2008
    Posts
    19
    Location
    thanks for your help, I was looking at a career change after 20 years in transport (you think your'e sad!!) what do you think of my 1st attempt at an excel dashboard??

  20. #20
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I think it is good, you have not made the cardinal error of too much extraneous colour, and in general you are using informative charts (not a pie to be seen). I do not like speedo charts though, they lack information, and it can usually conveyed better. Remember, you can use data in a dashboard, it doesn't have to be all gizmos and widgets.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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