• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I would like to display a graphic in an Userform!

Hello, I would like to get help with the following thing. I have a Workbook called Games Graph, it contains a worksheet called "Chart", the one has a simple chart. I have made an Userform called "Chart". I would like to display(in realtime) the chart in the userform. Can it be possible?

Thank you in advance.


You all are the best.
 

Attachments

  • GAMES GRAPH.xlsm
    27.2 KB · Views: 11
.
Code:
Option Explicit

Dim ChartPu As Chart

Sub UpdateChart()
    Dim Fname As String
    Dim ChartPu
    Dim Image1 As Image
    Set ChartPu = Sheets("Chart").ChartObjects("Chart 1").Chart
    With ChartPu
        .Parent.Width = 300
        .Parent.Height = 150
    End With
    'Save chart as GIF
    Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
    ChartPu.Export Filename:=Fname, FilterName:="GIF"
  
    'Show the chart
    Chart.Image1.Picture = LoadPicture(Fname)
      
End Sub
 

Attachments

  • GAMES GRAPH.xlsm
    24.3 KB · Views: 20
Code:
Private Sub UserForm_Initialize()
Set CurrentChart = Sheets("Chart").ChartObjects(1).Chart
    CHname = ThisWorkbook.Path & "\temp.gif"
        CurrentChart.Export Filename:=CHname, FilterName:="GIF"
            Image1.Picture = LoadPicture(CHname)
Kill CHname
End Sub
 

Attachments

  • GAMES GRAPH.xlsm
    29 KB · Views: 32
Dear All, How to add the table column in the userform and when we change the column value also automatically the chart also change.

Let say the brasil value is 97 and we change the column in the userform in value 98 than automatically change the chart.

Just use the above games graph to update. Thanks for your answer.
 
Back
Top