Updating Source Data in powerpoint charts


New Member
Nov 8, 2013
Hello forum,

I have charts in powerpoint which are linked to an excel workbook.

When trying to change the source data using .SetSourceData, nothing happens. It works if I manually change the data range first, and then re run the code, but I may aswell set the source data manually each time.

My code is written in excel vba 2010 & i'm using windows 7

Sub firstbr()

     'Requires a reference to the Microsoft PowerPoint Library via the Tools - Reference menu in the VBE
    Dim ppApp As PowerPoint.Application
    Dim ppSlide As PowerPoint.Slide
    Dim SlideNumber As PowerPoint.SlideRange
'----------------------Slide 4--------------------------
    On Error GoTo 0
    Sheets("BR Exec Summary").Select
     'Look for existing instance
    On Error Resume Next
    Set ppApp = GetObject(, "PowerPoint.Application")
    On Error GoTo 0
     'Make the instance visible
    ppApp.Visible = True
    'Copy & Paste into correct place
    ppApp.ActiveWindow.View.GotoSlide (4)
    Set ppSlide = ppApp.ActiveWindow.View.Slide

    'top chart
    col = Range("A2").End(xlToRight).Column
    rw = Cells(2, col + 3).End(xlDown).Row
    colst = Split(Cells(1, col + 2).Address(True, False), "$")
    colend = Split(Cells(1, col + 3).Address(True, False), "$")
    ppSlide.Shapes("Chart 10").Chart.SetSourceData Source:="='BR Exec Summary'!$" & colst(0) & "$2:$" & colend(0) & "$" & rw
The correct string is of the range is created, but the charts data source is not changed.

Any help on this would be great.


Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...