help with userform

JasonLeVan

Board Regular
Joined
Feb 7, 2011
Messages
121
I have a userform, and i have a chart on sheet2. I have a macro that saves the chart as a image then in the userform i have a image link of that chart, works great. except that if i make a change to the chart data, then save the picture and run the userform it does not load the newest picture, is there a way to make the userform refresh itself to the newest version of the saved picture
 

Some videos you may like

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Try this :-
Place a Image frame in you userform "Image1" then run this code in the Userform Initialize _Event.
This will save your chart as a "gif" image file, and insert it on you sheet, refreshed each time the Image is loaded.
Code:
Private Sub UserForm_Initialize()
Dim Currentchart As Chart
Dim fname As String
Set Currentchart = Sheets("Sheet1").ChartObjects(1).Chart
fname = ThisWorkbook.Path & "\temp.gif"
Currentchart.Export Filename:=fname, filtername:="Gif"
Image1.Picture = LoadPicture(fname)
End Sub
Mick
 

Watch MrExcel Video

Forum statistics

Threads
1,109,425
Messages
5,528,688
Members
409,830
Latest member
KT50

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top