Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Inserting an image

Hi All,

I am trying to insert an image to Cell A1 to A3 if condition in Cell
B1 to B3 is met.

1. Pictures are saved under C:\Documents\Pictures\

2. Condition (Value in Cell B1,B2 and B3)
if value = "A" then insert 123.jpg
if value = "B" then insert 345.jpg
if value = "C" then insert 456.jpg

e.g. if cell B1 = "A" then insert 123.jpg in cell A1.

Ive done this so far,

Sub insert()
Dim myPath As String
Dim MyImage As String
myPath = "C:\Documents\Pictures\"

Range("B1").Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""A"",
Activesheet.Pictures.Insert(myPath & 123.jpg),"")
..
..
..
..
End Sub

Q: How do I code in VBA to insert specific picture when conditions are
met? is it even possible?
if it is not, what is the best way to achieve the result that I am
looking for?

Thank you so much for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Inserting an image

Hi James,

See J.E. McGimpsey's approach at:

Looking up and displaying a picture based on a cell value
http://www.mcgimpsey.com/excel/lookuppics.html




---
Regards.
Norman


"James8309" wrote in message
...
Hi All,

I am trying to insert an image to Cell A1 to A3 if condition in Cell
B1 to B3 is met.

1. Pictures are saved under C:\Documents\Pictures\

2. Condition (Value in Cell B1,B2 and B3)
if value = "A" then insert 123.jpg
if value = "B" then insert 345.jpg
if value = "C" then insert 456.jpg

e.g. if cell B1 = "A" then insert 123.jpg in cell A1.

Ive done this so far,

Sub insert()
Dim myPath As String
Dim MyImage As String
myPath = "C:\Documents\Pictures\"

Range("B1").Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""A"",
Activesheet.Pictures.Insert(myPath & 123.jpg),"")
.
.
.
.
End Sub

Q: How do I code in VBA to insert specific picture when conditions are
met? is it even possible?
if it is not, what is the best way to achieve the result that I am
looking for?

Thank you so much for your help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Inserting an image

In addition to Norman's suggestion of John's lookuppics which is limited to one
picture at a time you could download Bernie Dietrick's sample workbook which
allows for more than one picture to be shown.

http://www.contextures.on.ca/excelfiles.html#DataVal

DV0049 - ClipArt Selection

Edit the code to suit.

Note: with either method the images must be stored on the worksheet.


Gord Dibben MS Excel MVP

On Tue, 3 Jun 2008 00:04:57 -0700 (PDT), James8309
wrote:

Hi All,

I am trying to insert an image to Cell A1 to A3 if condition in Cell
B1 to B3 is met.

1. Pictures are saved under C:\Documents\Pictures\

2. Condition (Value in Cell B1,B2 and B3)
if value = "A" then insert 123.jpg
if value = "B" then insert 345.jpg
if value = "C" then insert 456.jpg

e.g. if cell B1 = "A" then insert 123.jpg in cell A1.

Ive done this so far,

Sub insert()
Dim myPath As String
Dim MyImage As String
myPath = "C:\Documents\Pictures\"

Range("B1").Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""A"",
Activesheet.Pictures.Insert(myPath & 123.jpg),"")
.
.
.
.
End Sub

Q: How do I code in VBA to insert specific picture when conditions are
met? is it even possible?
if it is not, what is the best way to achieve the result that I am
looking for?

Thank you so much for your help.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Inserting an image

On Jun 4, 1:55*am, Gord Dibben <gorddibbATshawDOTca wrote:
In addition to Norman's suggestion of John's lookuppics which is limited to one
picture at a time you could download Bernie Dietrick's sample workbook which
allows for more than one picture to be shown.

http://www.contextures.on.ca/excelfiles.html#DataVal

DV0049 - ClipArt Selection

Edit the code to suit.

Note: with either method the images must be stored on the worksheet.

Gord Dibben *MS Excel MVP

On Tue, 3 Jun 2008 00:04:57 -0700 (PDT), James8309
wrote:



Hi All,


I am trying to insert an image to Cell A1 to A3 if condition in Cell
B1 to B3 is met.


1. Pictures are saved under C:\Documents\Pictures\


2. Condition (Value in Cell B1,B2 and B3)
if value = "A" then insert 123.jpg
if value = "B" then insert 345.jpg
if value = "C" then insert 456.jpg


e.g. if cell B1 = "A" then insert 123.jpg in cell A1.


Ive done this so far,


Sub insert()
*Dim myPath As String
*Dim MyImage As String
* *myPath = "C:\Documents\Pictures\"


* Range("B1").Activate
* ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""A"",
Activesheet.Pictures.Insert(myPath & 123.jpg),"")
.
.
.
.
End Sub


Q: How do I code in VBA to insert specific picture when conditions are
met? is it even possible?
if it is not, what is the best way to achieve the result that I am
looking for?


Thank you so much for your help.- Hide quoted text -


- Show quoted text -


Thank you for your help.Now I am one step closer to what I want! :D

Those two links above definetely shines light on me however how do i
alter those codes to automate the picture inserting process in B1, B2
and B3 using the conditions in A1, A2 and A3 instead of using the
dropbox?


thanks again.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Inserting an image

Lots of changes to be made if you want to use Bernie's code.

Change picture names, clear DV lists, re-define named ranges for cells and
ranges, change the code to reflect new placement of picture to right of A1:A3,
change the KeyCells range.

See how Bernie has defined the cells and ranges in InsertNameDefine

I will try to run something up but will be a day or so. Too late tonight and
have a Golf Match tomorrow.

NOTE: if your values are really A, B or C you will run into defining a named
range for C.

Excel reserves that, along with R for R1C1 notation so cannot be used as a
defined name.


Gord

On Tue, 3 Jun 2008 16:28:47 -0700 (PDT), James8309
wrote:

Thank you for your help.Now I am one step closer to what I want! :D

Those two links above definetely shines light on me however how do i
alter those codes to automate the picture inserting process in B1, B2
and B3 using the conditions in A1, A2 and A3 instead of using the
dropbox?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default Inserting an image

Hi Norman

I tried using the code on:

http://www.mcgimpsey.com/excel/lookuppics.html

And I managed to get it to work very well, the only problem is I need to
make 1 image visible but the code sets all images to visible = False.

If I have Picture 1 to 7 set to visible = False, do you know how I can set
Picture 8 to visible = True?

Any help would be appreciated.

Cheers

Danny

"Norman Jones" wrote:

Hi James,

See J.E. McGimpsey's approach at:

Looking up and displaying a picture based on a cell value
http://www.mcgimpsey.com/excel/lookuppics.html




---
Regards.
Norman


"James8309" wrote in message
...
Hi All,

I am trying to insert an image to Cell A1 to A3 if condition in Cell
B1 to B3 is met.

1. Pictures are saved under C:\Documents\Pictures\

2. Condition (Value in Cell B1,B2 and B3)
if value = "A" then insert 123.jpg
if value = "B" then insert 345.jpg
if value = "C" then insert 456.jpg

e.g. if cell B1 = "A" then insert 123.jpg in cell A1.

Ive done this so far,

Sub insert()
Dim myPath As String
Dim MyImage As String
myPath = "C:\Documents\Pictures\"

Range("B1").Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""A"",
Activesheet.Pictures.Insert(myPath & 123.jpg),"")
.
.
.
.
End Sub

Q: How do I code in VBA to insert specific picture when conditions are
met? is it even possible?
if it is not, what is the best way to achieve the result that I am
looking for?

Thank you so much for your help.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Inserting an image

Check your other post.

Danny wrote:

Hi Norman

I tried using the code on:

http://www.mcgimpsey.com/excel/lookuppics.html

And I managed to get it to work very well, the only problem is I need to
make 1 image visible but the code sets all images to visible = False.

If I have Picture 1 to 7 set to visible = False, do you know how I can set
Picture 8 to visible = True?

Any help would be appreciated.

Cheers

Danny

"Norman Jones" wrote:

Hi James,

See J.E. McGimpsey's approach at:

Looking up and displaying a picture based on a cell value
http://www.mcgimpsey.com/excel/lookuppics.html




---
Regards.
Norman


"James8309" wrote in message
...
Hi All,

I am trying to insert an image to Cell A1 to A3 if condition in Cell
B1 to B3 is met.

1. Pictures are saved under C:\Documents\Pictures\

2. Condition (Value in Cell B1,B2 and B3)
if value = "A" then insert 123.jpg
if value = "B" then insert 345.jpg
if value = "C" then insert 456.jpg

e.g. if cell B1 = "A" then insert 123.jpg in cell A1.

Ive done this so far,

Sub insert()
Dim myPath As String
Dim MyImage As String
myPath = "C:\Documents\Pictures\"

Range("B1").Activate
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""A"",
Activesheet.Pictures.Insert(myPath & 123.jpg),"")
.
.
.
.
End Sub

Q: How do I code in VBA to insert specific picture when conditions are
met? is it even possible?
if it is not, what is the best way to achieve the result that I am
looking for?

Thank you so much for your help.



--

Dave Peterson
Reply
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
Inserting an Image or Line BigPig Excel Discussion (Misc queries) 7 February 10th 06 02:14 AM
Inserting an image or line BigPig Excel Worksheet Functions 0 February 9th 06 07:24 PM
Inserting image Browie[_2_] Excel Programming 0 December 15th 05 11:54 AM
Inserting .bmp image using VLOOKUP shashak[_6_] Excel Programming 0 November 13th 04 07:51 PM
Inserting .bmp image using VLOOKUP shashak[_3_] Excel Programming 0 November 10th 04 03:31 PM


All times are GMT +1. The time now is 11:55 AM.

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

About Us

"It's about Microsoft Excel"