LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default If statement to add picture based on cell value

Hello-

I have an if statement that should add a picture to cell A15 based on
the value of E6. When I run the code, the picture for the first IF
statement value always comes up (8-8.24) even though the value of E6
is 9.17. Any ideas?

Thanks-

Scott

Sub PIC()
Dim myCell As Range
Set myCell = Selection
Dim shp1 As Picture

On Error Resume Next

If Range("E6").Value <= "8" Then
ActiveSheet.Shapes("a15 Picture").Delete
Range("a15").Select
ActiveSheet.Pictures.Insert("M:\custserv\CentreVuR eports\Images
\1.wmf").Select
Selection.Name = "a15 Picture"
ElseIf Range("E6").Value <= "8.25" Then
ActiveSheet.Shapes("a15 Picture").Delete
Range("a15").Select
ActiveSheet.Pictures.Insert("M:\custserv\CentreVuR eports\Images
\2.wmf").Select
Selection.Name = "a15 Picture"
ElseIf Range("E6").Value <= "8.5" Then
ActiveSheet.Shapes("a15 Picture").Delete
Range("a15").Select
ActiveSheet.Pictures.Insert("M:\custserv\CentreVuR eports\Images
\3.wmf").Select
Selection.Name = "a15 Picture"
ElseIf Range("E6").Value <= "8.75" Then
ActiveSheet.Shapes("a15 Picture").Delete
Range("a15").Select
ActiveSheet.Pictures.Insert("M:\custserv\CentreVuR eports\Images
\4.wmf").Select
Selection.Name = "a15 Picture"
ElseIf Range("E6").Value <= "9" Then
ActiveSheet.Shapes("a15 Picture").Delete
Range("a15").Select
ActiveSheet.Pictures.Insert("M:\custserv\CentreVuR eports\Images
\5.wmf").Select
Selection.Name = "a15 Picture"
ElseIf Range("E6").Value <= "9.25" Then
ActiveSheet.Shapes("a15 Picture").Delete
Range("a15").Select
ActiveSheet.Pictures.Insert("M:\custserv\CentreVuR eports\Images
\6.wmf").Select
Selection.Name = "a15 Picture"

End If

myCell.Select
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Picture based on cell value Jim Excel Worksheet Functions 3 July 24th 09 01:28 PM
Insert picture based on cell value (unlimited) djk44 Excel Programming 4 January 11th 07 05:40 AM
Inserting picture into excel based on # in the another cell jstaggs Excel Worksheet Functions 2 December 14th 06 06:55 PM
How to add picture based on a cell value TUNGANA KURMA RAJU Excel Discussion (Misc queries) 3 October 31st 05 04:47 AM
how do I show a picture in excel based on cell data Wishing to Excel Excel Discussion (Misc queries) 2 January 10th 05 04:39 PM


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"