![]() |
Align a picture/shape in the middle of a range("A1:H10")
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/ |
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/ . |
All times are GMT +1. The time now is 07:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com