Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Position drawing object relative to cell

I am trying to work out how to position an oval over a cell. On frmOval, if
the user selects a certain radio button, I want an oval to appear over a
specified cell.

I drew an oval of the correct size, and I would like to copy and paste it to
the correct spot. This is what I got from the Macro recorder, by copying,
pasting, and moving it into position. It seems clunky, and I'm wondering if
there is an easier way to specify the position relative to the cell. There
are 11 possible cell positions, based on 11 radio buttons.

If Me.optOval01.Value = True Then
ActiveSheet.Shapes("Oval 11").Select
Selection.Copy
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12#
Selection.ShapeRange.IncrementTop 18#
End If

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Position drawing object relative to cell

Here is some code to move an oval... You can use the height and width to
further move the oval.

Sub test()
Call MoveOval(Shapes("Oval 11"), Range("C10"))
End Sub

Sub MoveOval(ByRef shp As Shape, cell As Range)
'pass in a shape and a cell
shp.Top = cell.Top
shp.Left = cell.Left
End Sub
--
HTH...

Jim Thomlinson


"Horatio J. Bilge, Jr." wrote:

I am trying to work out how to position an oval over a cell. On frmOval, if
the user selects a certain radio button, I want an oval to appear over a
specified cell.

I drew an oval of the correct size, and I would like to copy and paste it to
the correct spot. This is what I got from the Macro recorder, by copying,
pasting, and moving it into position. It seems clunky, and I'm wondering if
there is an easier way to specify the position relative to the cell. There
are 11 possible cell positions, based on 11 radio buttons.

If Me.optOval01.Value = True Then
ActiveSheet.Shapes("Oval 11").Select
Selection.Copy
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12#
Selection.ShapeRange.IncrementTop 18#
End If

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Position drawing object relative to cell

That helps. I was able to adapt it to fit my needs.
Thanks,
~ Horatio

"Jim Thomlinson" wrote:

Here is some code to move an oval... You can use the height and width to
further move the oval.

Sub test()
Call MoveOval(Shapes("Oval 11"), Range("C10"))
End Sub

Sub MoveOval(ByRef shp As Shape, cell As Range)
'pass in a shape and a cell
shp.Top = cell.Top
shp.Left = cell.Left
End Sub
--
HTH...

Jim Thomlinson


"Horatio J. Bilge, Jr." wrote:

I am trying to work out how to position an oval over a cell. On frmOval, if
the user selects a certain radio button, I want an oval to appear over a
specified cell.

I drew an oval of the correct size, and I would like to copy and paste it to
the correct spot. This is what I got from the Macro recorder, by copying,
pasting, and moving it into position. It seems clunky, and I'm wondering if
there is an easier way to specify the position relative to the cell. There
are 11 possible cell positions, based on 11 radio buttons.

If Me.optOval01.Value = True Then
ActiveSheet.Shapes("Oval 11").Select
Selection.Copy
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12#
Selection.ShapeRange.IncrementTop 18#
End If

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 to macro to relative position jk9533 Excel Discussion (Misc queries) 6 October 15th 07 08:11 PM
Relative position of Employees Bob Davison Excel Worksheet Functions 9 May 8th 07 07:23 PM
how do i copy and inserted drawing object in a cell to multiple ce BROCK8292 Excel Discussion (Misc queries) 1 February 20th 07 09:11 PM
Displaying a cell relative to the position to another cell Tibbs Excel Discussion (Misc queries) 2 July 21st 06 08:28 AM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM


All times are GMT +1. The time now is 01:27 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"