View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default Change picture according to cell content

One way:

Paste your pictures onto the sheet, name them "Dog", "Cat",
"Hamster", etc, and position and size them as you want.

Put this in the worksheet code module.

Private Sub Worksheet_Calculate()
Dim picSelect As String
picSelect = LCase(Range("A1").Text)
Application.ScreenUpdating = False
With ActiveSheet
.Shapes("Dog").Visible = (picSelect = "dog")
.Shapes("Cat").Visible = (picSelect = "cat")
.Shapes("Hamster").Visible = (picSelect = "hamster")
End With
Application.ScreenUpdating = True
End Sub



In article ,
"paulma" wrote:

I am trying to create an excel sheet where the program changes a picture on
the sheet depending on the contents of a particular cell.

For example if cell A1 contains "Cat" I want to display a cat somewhere else
on the sheet, if it contains "dog" I want to display a picture of a dog.

How would I go about doing this??? Would I need to use VBA and if so How??

Thanks in Advance

Paul Martin