View Full Version : anchor picture to cell
grichey
05-04-2009, 06:16 AM
Hello,
I have a picture (logo) that goes on every sheet of a workbook with numerous sheets. Because it looks ridiculous for the image to be a different size on each one, I am trying to figure out a way to just anchor the image to a cell so that it will not only be in the correct place inspite of someone inserting rows above or below but also will be of a consistent size.
I appreciate any ideas.
Kenneth Hobs
05-04-2009, 12:33 PM
Is code even needed? You can set it not to resize by right clicking it > Format Control > Properties > Don't Move or Size with Cells.
grichey
05-04-2009, 12:39 PM
Well, I don't know that code is needed. The problem with doing it the way you describe is I'll have to do that every time I put the image in. I was looking for something that doesn't involve right clicking and editing the properties of the image every single time since the size / shape is the same every time.
I was wondering if it were possible to just put the image on a hidden sheet and references it so I don't have to actually store 20 images in a workbook.
Kenneth Hobs
05-04-2009, 02:26 PM
You could add it as a link. I would put the images in a picture folder or the current workbook's folder.
This example shows how you could add one for the current sheet. You could easily add it to iterate a number of sheets.
ActiveSheet.OLEObjects.Add(ThisWorkbook.Path & "\ken.jpg", Link:=True, _
DisplayAsIcon:=False, Left:=252.75, Top:=90.75, Width:=162, Height:= _
126.75).Select
With Selection
.Placement = xlFreeFloating
.PrintObject = True
End With
Range("A1").Select
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.