Hello again Morganm,
I would be glad to.
I have divided the macro into two parts:
- UpdateSheet will be the macro you assign to a button, updating the
entire sheet. You can add as many Call statements to UpdateSheet as
needed to handle all the value cells / image destinations.
- InsertPict will remove any previous image then paste, locate &
rename the image file referenced
Copy / paste the new macro just like the previous answer described.
Make any changes you need (or try the simple one first - then fix it).
Once done, return to Excel to create the button / run the macro.
You can assign this macro to a button on the spreadsheet with the following steps.
[1] Tools -> Customize will bring up a dialog box with two tabs. Make
sure the Toolbar tab is selected and that the Forms line has a
checkmark. Select OK to bring up the toolbar.
[2] Select the "button" shaped item on the toolbar (it is the right
side of second row on my copy of Excel).
[3] Click and drag across the area you want to add the button. On my
system it came up with the name Button13_Click, but we'll fix that
shortly. You should get a dialog box asking which macro you want to
assign to the Button. Select UpdateSheet and OK.
[4] Double click inside the button to select its name and change it to
something appropriate. I made it "Update" on my copy.
[5] While it looks like a relocatable object, you can resize it / move
it around just like any other image. When done - click outside the
button and it will now be active.
Click on the button and the macro should run and do the image updates.
Use a clarification request to let me know if you have any problems
with this macro or need any additional explanation.
--Maniac
'
' UpdateSheet Macro
' Macro created 3/31/2004 by Maniac
'
Sub UpdateSheet()
Call InsertPict("$B$1", "$J$1")
End Sub
Sub InsertPict(CellRef$, DestRef$)
'
' InsertPict Macro
' Macro recorded 3/29/2004 by Maniac
'
' Disable errors
' Attempt to delete any existing shape with the same name
On Error Resume Next
ActiveSheet.Shapes(DestRef$).Delete
On Error GoTo 0
' error processing now enabled again
ActiveSheet.Pictures.Insert(Range(CellRef$).Value).Select
Selection.ShapeRange.Left = Range(DestRef$).Left
Selection.ShapeRange.Top = Range(DestRef$).Top
Selection.ShapeRange.Name = DestRef$
End Sub |