View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default Insert picture from file (Need VBA help)

On Jul 31, 1:37 pm, TheMilkGuy wrote:
Outstanding Ken!

You're a rock star... Worked like a charm.

Cheers,
Craig

On Jul 30, 6:01 pm, Ken Johnson wrote:

On Jul 31, 7:41 am, TheMilkGuy wrote:


Hi folks!


I stumbled across this:http://www.contextures.on.ca/ShowFilePicsDemo.zip


Which will allow you to insert graphics into a defined area based on
data from a drop-down box. (I'm using Excel 2003)


I would REALLY like to get this to work with my current project, but
my drop-down list and graphics are on two separate worksheets in the
same file.


Can anyone offer some VBA advice on how to make this happen? I
understand it on a kindergarten level. ;)


Many thanks!!!
Craig


Hi Craig,


I downloaded the link then did the following to get the picture
displayed on a different sheet...


1. Inserted a new sheet which was automatically named Sheet1.
2. Went Insert|Name|Define... to bring up the Define Name dialog.
3. Clicked on rngPicDisplayCells in the list of defined names. The
refers to: box then showed the formula...


=ShowFilePicsDemo!$D$6:$D$10


which I changed to...


=Sheet1!$D$6:$D$10


so that the picture would appear on the new sheet, Sheet1, at the same
location ($D$6:$D$10).


After making that change to the Refers to: formula for
rngPicDisplayCells, I then clicked the Add button then OK.


4. I then right clicked the ShowFilePicsDemo sheet tab and selected
View code from the pop up to get into that worksheet's code module.
In the code module I changed the following line...


rDestCells:=Range("rngPicDisplayCells"), _


to...


rDestCells:=Worksheets("Sheet1").Range("rngPicDisp layCells"), _


5. Saved the changes then exited the VBA Editor.


After those changes were made the picture whose name was selected from
the drop down on the ShowFilePicsDemo sheet appeared in $D$6:$D$10 on
Sheet1.


Ken Johnson


Great!
Thanks for the feedback.

Ken Johnson