Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I "align middle" the legend and plot area? StonyCreeker Charts and Charting in Excel 2 April 23rd 23 09:05 AM
Chg 1 "Last, First Mid" column to 3 "First", "Middle", "Last" colu JBird11002 Excel Discussion (Misc queries) 4 August 15th 08 06:31 PM
Align a picture/shape in the middle of a range("A1:H10") Andoni[_20_] Excel Programming 0 August 25th 04 11:09 PM
align a picture/shape in a Range! Andoni[_18_] Excel Programming 1 August 22nd 04 06:11 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 03:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"