Picture help (for an excel virgin)

J

joga11

ok, so at work i often have to format pictures into excel, they go fou
to a page (landscape), with labels

i've already done up a macro simply to resize them so all i have to d
is position them, but, ever in search of an easier way to do things

i was toying with the idea of making a template with specificall
sized cells to insert the pictures, and just type up the labels.

my question is this

is there a way to insert a picture and confine its size to a cell o
predetermined dimensions??
 
G

Guest

hi,
no. images are objects that sit on top of the sheet. they
cannot be assigned(put in) a cell.
 
D

Dave Peterson

This is one way:

Option Explicit
Sub testme()

Dim myPict As Picture
Dim myFileName As Variant
Dim picName As String
Dim myRng As Range

myFileName = Application.GetOpenFilename _
(filefilter:="Pictures , *.jpg;*.bmp;*.gif", Title:="Select Picture")
If myFileName = False Then
Exit Sub 'no file selected
End If

With ActiveSheet
Set myRng = .Range("a3:b4")
Set myPict = .Pictures.Insert(myFileName)
With myPict
.Left = myRng.Left
.Top = myRng.Top
.Height = myRng.Height
.Width = myRng.Width
End With
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top