Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default align autoshape with centre / right of excel cell

Hi all,

I want to align an autoshape using vba with some cells on a
spreadsheet... I picked up the following from this newsgroup a while
back:


"Use something like the following to align the top left hand corner of
the
copied shape to the G column and the active cell row:

Sheets("Data").Shapes("Up Arrow").Copy
ActiveSheet.Paste
With Cells(ActiveCell.Row, "G")
Selection.Top = .Top
Selection.Left = .Left
End With


John Green (Excel MVP) "

which is great - works perfectly (cheers John!), but I want to align to
the centre right of the cell, not the top left! is this possible?

Many thanks

chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default align autoshape with centre / right of excel cell

please explain what center right means.

if you mean the right side of the cell, isn't that the left side of the cell
to the right.

Selection.Left = .offset(0,1).Left

to get the center of a cell height wise

ActiveCell.Top + activeCell.height / 2

Selection .Top = .Top + .height / 2

--
Regards,
Tom Ogilvy


" wrote:

Hi all,

I want to align an autoshape using vba with some cells on a
spreadsheet... I picked up the following from this newsgroup a while
back:


"Use something like the following to align the top left hand corner of
the
copied shape to the G column and the active cell row:

Sheets("Data").Shapes("Up Arrow").Copy
ActiveSheet.Paste
With Cells(ActiveCell.Row, "G")
Selection.Top = .Top
Selection.Left = .Left
End With


John Green (Excel MVP) "

which is great - works perfectly (cheers John!), but I want to align to
the centre right of the cell, not the top left! is this possible?

Many thanks

chris


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default align autoshape with centre / right of excel cell

thanks Tom - you are a genius :)



Tom Ogilvy wrote:
please explain what center right means.

if you mean the right side of the cell, isn't that the left side of the cell
to the right.

Selection.Left = .offset(0,1).Left

to get the center of a cell height wise

ActiveCell.Top + activeCell.height / 2

Selection .Top = .Top + .height / 2

--
Regards,
Tom Ogilvy


" wrote:

Hi all,

I want to align an autoshape using vba with some cells on a
spreadsheet... I picked up the following from this newsgroup a while
back:


"Use something like the following to align the top left hand corner of
the
copied shape to the G column and the active cell row:

Sheets("Data").Shapes("Up Arrow").Copy
ActiveSheet.Paste
With Cells(ActiveCell.Row, "G")
Selection.Top = .Top
Selection.Left = .Left
End With


John Green (Excel MVP) "

which is great - works perfectly (cheers John!), but I want to align to
the centre right of the cell, not the top left! is this possible?

Many thanks

chris



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 do I get Excel to print in page centre? SimoninParis Excel Discussion (Misc queries) 2 January 31st 10 04:43 PM
How to display the cell it goes to at the centre of the monitor screen? cyberdude Excel Discussion (Misc queries) 1 July 23rd 06 01:20 PM
How to display the cell it goes to at the centre of the monitor screen cyberdude Excel Programming 1 July 23rd 06 10:18 AM
Aligning numbers to the centre of the cell Ramesh Babu Excel Discussion (Misc queries) 2 July 1st 06 11:28 PM
How do I get "centre across selection" to centre properly? Marjon Excel Discussion (Misc queries) 5 March 17th 06 12:24 AM


All times are GMT +1. The time now is 04:01 AM.

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"