View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Positioning pictures in a cell

Both cells and pictures have .Top and .Left properties, that define their
location, and .Width and .Height properties that define their size. For
example, if I wanted to put a picture (MyPic) inside cell B2, have it sized
at 90% of the cell size and be centered in the cell, this is what I would do:
With Range("B2")
MyPic.Width = 0.9 * .Width
MyPic.Height = 0.9 * .Height
MyPic.Top = .Top + 0.05 * .Height ' For picture 90% of height, this will
center it top to bottom
MyPic.Width = .Left + 0.05 * .Width
End With

(Note this assumes the aspect ratio of the picture is not locked. It is
possible to do the reverse: to fit the cell to the size of the picture)
--
- K Dales


"ZipCurs" wrote:

I have a table with pictures (jpegs) and descriptions. I would like to use a
macro to insert the picture in the cell next to the description and center it
in the cell. I can easily get it near the cell, but I can't seem to find a
way to position the picture exactly where it want it. Any help appreciated.