Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Handling Pictures in Excel

Status
Not open for further replies.

eAlchemist

Technical User
Aug 28, 2003
64
US

I can't figure out how to handle pictures in Excel. I've inserted two bitmaps into a worksheet, and I'd like to for one to be visible when a certain cell is >=x and make the other visible when that cell is <x. I know how to test the cells and all, and I figured that I'd use the activate event on the worksheet to test the cell. The problem is, I can't figure out how to manipulate the image. Can anyone help?

Thanks,
Chris
 
Have you tried the macro recorder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Great idea. Don't know why I didn't think of that. However, all it gave me was this:
Selection.ShapeRange.IncrementLeft 141#

That still doesn't tell me how to select the object. :(

Thanks,
Chris
 
Instead of simply inserting the pictures, use the Control Toolbox toolbar to place Image objects. Set the Picture and PictureSizeMode properties for your pictures. Then you can use code like this:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
  If Target.Address = "$F$7" Then
    If Target.Value = 1 Then
      Image1.Visible = True
      Image2.Visible = False
    Else
      Image1.Visible = False
      Image2.Visible = True
    End If
  End If
End Sub
I used F7 for the "certain cell" but you can modify the code to suit your needs.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top