Locking picture in cell

C

Cathy

I am trying to create an inventory in Excel using a small picture of the item
in the first column and other columns have the create date, inventory number,
price, etc. When I sort all, I lose the positioning of the inventory picture
with the row. How do I lock the pic with the row?
 
G

Gord Dibben

Size the object so it fits entirely within the cell boundaries.

Format all pictures to "move and size with cells".


Gord Dibben MS Excel MVP
 
C

Cathy

OMG!! You are a genius! Some of my images were over the cell boundary lines
so when I experimented with the format picture, it still got displaced when I
sorted. I will make sure in the future to make the images smaller than the
cell. Is there a way to set that as the default for all images inserted in to
this document?

Thank you so very much!!
 
G

Gord Dibben

I can't think of code to write to default all inserted images to a particular
size. Too late at night for an old geezer.

I can supply a macro to resize all selected images to a certain size.
Experiment with the 12# and 24# to adjust height and width.

Placement of these images would be up to you.

Sub Reset_Shapes()
Dim shp As Shape
On Error GoTo whoops
For Each shp In ActiveSheet.Shapes
With Selection.ShapeRange
.LockAspectRatio = msoFalse
.Height = 12#
.Width = 24#
.Rotation = 0#
End With
Next shp
Exit Sub
whoops:
MsgBox "You have not selected any picture(s)"
End Sub


Gord
 

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