View Single Post
  #4   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

If your "dog", "cat", etc. values aren'te the result of
calculations, but of user entries, then you need to use the
Worksheet_Change() event rather than the Worksheet_Calculate event.
I've posted a demo file he

ftp://ftp.mcgimpsey.com/excel/paulma_demo.xls

Enter "dog", "cat" or "hamster" in A1 and the pictures will change.

In article ,
"J.E. McGimpsey" wrote:

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