ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to insert and load an image for Excel 2003? (https://www.excelbanter.com/excel-discussion-misc-queries/255752-how-insert-load-image-excel-2003-a.html)

Eric

How to insert and load an image for Excel 2003?
 
Does anyone have any suggestions on how to display image based on if-condition?
I have insert an image into excel, and I would like to set an if statement
to display this image, does anyone have any suggestions on how to insert
those images into excel, and how to load it in Excel 2003?
Thanks in advance for any suggestions
Eric


Jacob Skaria

How to insert and load an image for Excel 2003?
 
Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Edit the pciture path and get back to to worksheet and
enter 1 in cell A1..If you enter anything else the pickture will be
removed.....

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Range("A1") = 1 Then
Set myPic = ActiveSheet.Pictures.Insert("C:\TempPic.JPG")
Else
Set myPic = ActiveSheet.Pictures(1)
myPic.Delete
End If

End Sub


--
Jacob


"Eric" wrote:

Does anyone have any suggestions on how to display image based on if-condition?
I have insert an image into excel, and I would like to set an if statement
to display this image, does anyone have any suggestions on how to insert
those images into excel, and how to load it in Excel 2003?
Thanks in advance for any suggestions
Eric


Jacob Skaria

How to insert and load an image for Excel 2003?
 
Missed to check the Target Address....

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
If Range("A1") = 1 Then
Set myPic = ActiveSheet.Pictures.Insert("C:\TempPic.JPG")
Else
Set myPic = ActiveSheet.Pictures(1)
myPic.Delete
End If
End If
End Sub

--
Jacob


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Edit the pciture path and get back to to worksheet and
enter 1 in cell A1..If you enter anything else the pickture will be
removed.....

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Range("A1") = 1 Then
Set myPic = ActiveSheet.Pictures.Insert("C:\TempPic.JPG")
Else
Set myPic = ActiveSheet.Pictures(1)
myPic.Delete
End If

End Sub


--
Jacob


"Eric" wrote:

Does anyone have any suggestions on how to display image based on if-condition?
I have insert an image into excel, and I would like to set an if statement
to display this image, does anyone have any suggestions on how to insert
those images into excel, and how to load it in Excel 2003?
Thanks in advance for any suggestions
Eric


Eric

How to insert and load an image for Excel 2003?
 
Thank you very much for suggestions
I get 2 images, if A1=1, then 1.gif, else if A1=2, then 2.gif, else nothing.
Do you have any suggestions on how to modify the code to do it?
Thank you very much for any suggestions
Eric

"Jacob Skaria" wrote:

Missed to check the Target Address....

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
If Range("A1") = 1 Then
Set myPic = ActiveSheet.Pictures.Insert("C:\TempPic.JPG")
Else
Set myPic = ActiveSheet.Pictures(1)
myPic.Delete
End If
End If
End Sub

--
Jacob


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Edit the pciture path and get back to to worksheet and
enter 1 in cell A1..If you enter anything else the pickture will be
removed.....

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Range("A1") = 1 Then
Set myPic = ActiveSheet.Pictures.Insert("C:\TempPic.JPG")
Else
Set myPic = ActiveSheet.Pictures(1)
myPic.Delete
End If

End Sub


--
Jacob


"Eric" wrote:

Does anyone have any suggestions on how to display image based on if-condition?
I have insert an image into excel, and I would like to set an if statement
to display this image, does anyone have any suggestions on how to insert
those images into excel, and how to load it in Excel 2003?
Thanks in advance for any suggestions
Eric



All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com