Trying to Add three pictures to a defined cell

carrguy01

New Member
Joined
Apr 7, 2011
Messages
42
I am not sure if i even got the right area on here yet! I am new but I am a quick learner so bear with me. I want to make a feature sheet that I will be changing on a regular basis. I want two different pictures to be located in the top right and top left of my page. The size of the original pictures very. So I need something that will resize them to make it uniformed. They can be in one cell or even merged cells that part does not bother me. The picture size has to be the same I am looking for 1.5 inch by 1.5 inch. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
I then want to put a picture of a house that will be changing all the time but the size I want to remain the same and that is 4 inch wide 2 inch tall. <o:p></o:p>
<o:p> </o:p>
Any help would be great. I am not sure if I need to put my email or not but here it is markcarr01@sympatico.ca<o:p></o:p>
<o:p></o:p>
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Maybe you can adapt this. It inserts a picture to fit inside a cell

Code:
Sub piccy()
ActiveSheet.Pictures.Insert ("C:\example\pic.jpg")
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
    .LockAspectRatio = False
    .Top = Range("C3").Top
    .Left = Range("C3").Left
    .Height = Range("C3").RowHeight
    .Width = Range("C3").Width
End With
End Sub
 

carrguy01

New Member
Joined
Apr 7, 2011
Messages
42
can you give me a step by step on how to run this! very brief i never used this kinda stuff before
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Press ALT + F11 to open the Visual Basic Editor, select Module from the Insert menu and paste the code into the white space on the right. Change this

C:\example\pic.jpg

to the path and name on your hard drive. Press ALT + Q.

Press ALT + F8, click on piccy then click the Run button.
 

carrguy01

New Member
Joined
Apr 7, 2011
Messages
42

ADVERTISEMENT

Thanks that worked great. I am trying to add to that fourmula to put a picture in Cell M3. And also also in k15. Can you show me how to add these pictures I have tried a few things but no luck
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
You would basically need to repeat the code, between Sub and End Sub, changing the path to the picture and the cell.
 

carrguy01

New Member
Joined
Apr 7, 2011
Messages
42

ADVERTISEMENT

This is what i have done. I get a a compile unexpected end with


Sub piccy()
ActiveSheet.Pictures.Insert ("C:\Users\Public\Pictures\work\85938.jpg")
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
.LockAspectRatio = False
.Top = Range("c3").Top
.Left = Range("c3").Left
.Height = Range("c3").RowHeight
.Width = Range("c3").Width
ActiveSheet.Pictures.Insert ("C:\Users\Public\Pictures\work\85938.jpg")
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
.LockAspectRatio = False
.Top = Range("f3").Top
.Left = Range("f3").Left
.Height = Range("f3").RowHeight
.Width = Range("f3").Width
End With
End Sub
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sub piccy()
ActiveSheet.Pictures.Insert ("C:\Users\Public\Pictures\work\85938.jpg")
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
    .LockAspectRatio = False
    .Top = Range("c3").Top
    .Left = Range("c3").Left
    .Height = Range("c3").RowHeight
    .Width = Range("c3").Width
End With
ActiveSheet.Pictures.Insert ("C:\Users\Public\Pictures\work\85938.jpg")
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
    .LockAspectRatio = False
    .Top = Range("f3").Top
    .Left = Range("f3").Left
    .Height = Range("f3").RowHeight
    .Width = Range("f3").Width
End With
End Sub
 

carrguy01

New Member
Joined
Apr 7, 2011
Messages
42
i have the above program working! but ran into some cell issue when i make the picture i want it does not let me do smaller cells to the right of the picture. Can i for example use the same kind of formula say from b2 to e2 wide and b2 to f5 high. So i can use the the cells next to the picture for math formuls?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,315
Members
414,053
Latest member
Dual Showman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top