J
James8309
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.
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.