Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Macro to display a picture

I saw a previous post that referred me to
Maybe something for you at John McGimpsey's site.

http://www.mcgimpsey.com/excel/lookuppics.html


and I am able to get this to work if i only have ONE picture that needs to
be displayed per worksheet. But i have the scenario there I look up the
pilot flying in A2 and need to display the photo in G2 for a range of rows
2:10

I altered the Marco to have a range of "a2:a10"
but i still only get a photo for the first row it finds. For all subsequent
rows the "formula" in G3 - G10 shows the correct correlating picture name but
no picture is displayed.

Any help would be greatly appreciated. THanks - JB

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro to display a picture

This is JE's code:

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("F1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub

Maybe you can make sure your pictures are nicely named. Then check to see if
the name begins with the value in that cell (F1 in JE's code):

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("F1")
For Each oPic In Me.Pictures
If lcase(oPic.Name) like (.Text & "*" )Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
'Exit For 'don't leave, keep looking for more matching
names
End If
Next oPic
End With
End Sub

But you'll have to make sure that the names of the pictures begin with the value
in F1.

JB Bates wrote:

I saw a previous post that referred me to
Maybe something for you at John McGimpsey's site.

http://www.mcgimpsey.com/excel/lookuppics.html

and I am able to get this to work if i only have ONE picture that needs to
be displayed per worksheet. But i have the scenario there I look up the
pilot flying in A2 and need to display the photo in G2 for a range of rows
2:10

I altered the Marco to have a range of "a2:a10"
but i still only get a photo for the first row it finds. For all subsequent
rows the "formula" in G3 - G10 shows the correct correlating picture name but
no picture is displayed.

Any help would be greatly appreciated. THanks - JB


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Picture display Martin Excel Discussion (Misc queries) 3 May 20th 08 03:41 PM
picture does not display in excel Van Excel Discussion (Misc queries) 0 April 24th 08 03:57 AM
Is there any way to get an excel formula to display a picture? ShawnC Excel Worksheet Functions 2 April 9th 08 03:12 PM
How can I conditionally display one picture over another? Arnold Reedy Excel Discussion (Misc queries) 1 February 5th 06 03:05 PM
display a picture in excel as an icon Jeff Excel Discussion (Misc queries) 1 February 12th 05 02:38 AM


All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"