LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Adding an series of "If" statement's to test for values

Try something like the following. I used the macro recorder in Excel 2000
to generate a lot of this, which uses the Pictures object. It is no longer
the recommended object (Microsoft now recommends the Shape object), so you
might want to experiment with putting the picture in a Shape object (or
whatever is now current if you are using Excel 2007!).

'----------------------------------------------------------------------
Sub ConvertToPictures()
Const GIF_Folder = "C:\My Documents\Humor\GIF\"

Dim rngCell As Range
Dim rngPictureNames As Range

Set rngPictureNames = ActiveSheet.Range("C1:C3")

For Each rngCell In rngPictureNames
ConvertTextToPicture rngCell, GIF_Folder, rngCell.Value
Next rngCell

Range("$A$1").Activate
End Sub

'----------------------------------------------------------------------
Sub ConvertTextToPicture(rngCell As Range, _
strFolder As String, _
strPictureName As String)

rngCell.Activate

On Error GoTo ExitSub

With rngCell.Parent
.Pictures _
.Insert(strFolder & strPictureName & ".gif"). _
Select
Selection.Name = strPictureName
End With

'Remove cell text (it has been replaced by the GIF).
rngCell.Value = ""

ExitSub:
End Sub

--
Regards,
Bill Renaud



 
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
Adding values in first "X" number of rows dynamically MattyP Excel Worksheet Functions 3 April 15th 09 06:13 PM
How do I test values in 2 different columns in a "sumif" formula? SteveS Excel Discussion (Misc queries) 8 June 3rd 07 11:27 PM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM
Debug.Print "Test " vbCodeLineNumber & ": " & varName TommySzalapski[_32_] Excel Programming 1 August 2nd 05 05:17 PM
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals BruceJ[_2_] Excel Programming 3 November 20th 03 01:55 AM


All times are GMT +1. The time now is 08:58 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"