View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default Align a picture/shape in the middle of a range("A1:H10")

Perhaps something like this:

Sub Test()
Dim Pict As Picture, rng As Range
Dim L As Long, T As Long

Application.ScreenUpdating = False
Set rng = Range("A1:H10")
Set Pict = ActiveSheet.Pictures. _
Insert("C:\Documents and Settings\greg\" & _
"My Documents\My Pictures\Sample.jpg")
L = rng.Left + rng.Width / 2 - Pict.Width / 2
T = rng.Top + rng.Height / 2 - Pict.Height / 2
Pict.Left = L: Pict.Top = T
Application.ScreenUpdating = True
End Sub

Regards,
Greg
-----Original Message-----
Hi!
Many Thanks in advance!

I have a few pictures, and or shapes, not necesarily the

pictures have
all the same size.
I do not want to change the Height or Width or my picture

I have a range("A1:H10")
How can I:
insert my picture as follws
HorizontalAlignment = xlCenter
VerticalAlignment = xlCenter
so;
keep my picture aligned horizontally and vertically in

the middle
of my range "A1:H10"


See you!


---
Message posted from http://www.ExcelForum.com/

.