Excel formula

1 view
Skip to first unread message

Paul

unread,
Feb 5, 2003, 11:39:01 AM2/5/03
to
Want to have a Cell in Excel, that will display a (JPEG)
picture, if another cell is greater than 1

i.e.
If(A3>1,\\server\art\picture.jpg,"nothing to display"

I need help to perform this functionally.

J.E. McGimpsey

unread,
Feb 5, 2003, 1:29:21 PM2/5/03
to
Worksheet functions can only return values to their calling cells. They
can't affect formatting or objects.

You could do something like this with an Event Macro. If A3 is a
calculated value, for instance:

Private Sub Worksheet_Calculate()
Const PIC As String = "\\server\art\pictue.jpg"
Static myPic As Picture
If myPic Is Nothing Then
Set myPic = ActiveSheet.Pictures.Insert(PIC)
With myPic
.Top = 100
.Left = 100
.Width = 200
.Height = 200
End With
End If
myPic.Visible = (Range("A3").Value > 1)
End Sub

Put this in the Worksheet Code module (right-click on the worksheet tab
and paste the code in the window that opens).

In article <05e701c2cd35$1647a4f0$cef82ecf@TK2MSFTNGXA08>,

Reply all
Reply to author
Forward
0 new messages