Hello,
I have a code that display's graph's from a worksheet in a userform. What i like to see is 3 graphs on 1 userform instead of using the buttons next and previous. How can i manage that with the code below?
Code:
Private Sub UserForm_Initialize()
ChartNum = 3
UpdateChart
End Sub
Private Sub PreviousButton_Click()
If ChartNum = 1 Then ChartNum = 3 Else ChartNum = ChartNum - 1
UpdateChart
End Sub
Private Sub NextButton_Click()
If ChartNum = 3 Then ChartNum = 1 Else ChartNum = ChartNum + 1
UpdateChart
End Sub
Private Sub CloseButton_Click()
Unload Me
End Sub
Private Sub UpdateChart()
Set CurrentChart = Sheets("DASHBOARD").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 600
CurrentChart.Parent.Height = 300
' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Show the chart
Image1.Picture = LoadPicture(Fname)
End Sub
Bookmarks