Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Place an autoshape

Whithout going through a whole bunch of trial and error, how can I easily set
the co-ordinates to place an autoshape rectangle over specific cells E10:E11?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Place an autoshape

This code will create the Rectangle Shape and place it on top of the Range
specified in the With statement on the worksheet indicated in the first line
of the With/EndWith block. The code also stores the name for the Rectangle
and its Index number in case you want to interact with it later on in your
code.

Dim RectangelIndexE10E11 As Long
Dim RectangleNameE10E11 As String
With Range("E10:E11")
Worksheets(1).Shapes.AddShape msoShapeRectangle, _
.Left, .Top, .Width, .Height
RectangelIndexE10E11 = Shapes.Count
RectangleNameE10E11 = Shapes(Shapes.Count).Name
End With

Rick


"alstubna" wrote in message
...
Whithout going through a whole bunch of trial and error, how can I easily
set
the co-ordinates to place an autoshape rectangle over specific cells
E10:E11?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Place an autoshape

Thanks Rick

That's certainly much neater than what I was trying to do.

BTW, I got a runtime error on this line:

RectangelIndexE10E11 = Shapes.Count


I didn't need that for my needs so I just took it out.

Al Stubna



On Feb 24, 4:17*pm, "Rick Rothstein \(MVP - VB\)"
wrote:
This code will create the Rectangle Shape and place it on top of the Range
specified in the With statement on the worksheet indicated in the first line
of the With/EndWith block. The code also stores the name for the Rectangle
and its Index number in case you want to interact with it later on in your
code.

Dim RectangelIndexE10E11 As Long
Dim RectangleNameE10E11 As String
With Range("E10:E11")
* Worksheets(1).Shapes.AddShape msoShapeRectangle, _
* * * * * * * * * * * * * * * * .Left, .Top, .Width, .Height
* RectangelIndexE10E11 = Shapes.Count
* RectangleNameE10E11 = Shapes(Shapes.Count).Name
End With

Rick

"alstubna" wrote in message

...



Whithout going through a whole bunch of trial and error, how can I easily
set
the co-ordinates to place an autoshape rectangle over specific cells
E10:E11?- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Place an autoshape

The error probably came from my running the code with the sheet with the
Shape on it active and, perhaps, you were not doing so. This should fix the
problem I would think...

Dim RectangelIndexE10E11 As Long
Dim RectangleNameE10E11 As String
With Range("E10:E11")
Worksheets(1).Shapes.AddShape msoShapeRectangle, _
.Left, .Top, .Width, .Height
End With
With Worksheets(1)
RectangelIndexE10E11 = .Shapes.Count
RectangleNameE10E11 = .Shapes(Shapes.Count).Name
End With

By the way, the actual sheet names could be subsituted for the sheet index
number that I used. For example,

Dim RectangelIndexE10E11 As Long
Dim RectangleNameE10E11 As String
With Range("E10:E11")
Worksheets("Sheet1").Shapes.AddShape msoShapeRectangle, _
.Left, .Top, .Width, .Height
End With
With Worksheets("Sheet1")
RectangelIndexE10E11 = .Shapes.Count
RectangleNameE10E11 = .Shapes(Shapes.Count).Name
End With

Rick


wrote in message
...
Thanks Rick

That's certainly much neater than what I was trying to do.

BTW, I got a runtime error on this line:

RectangelIndexE10E11 = Shapes.Count


I didn't need that for my needs so I just took it out.

Al Stubna



On Feb 24, 4:17 pm, "Rick Rothstein \(MVP - VB\)"
wrote:
This code will create the Rectangle Shape and place it on top of the Range
specified in the With statement on the worksheet indicated in the first
line
of the With/EndWith block. The code also stores the name for the Rectangle
and its Index number in case you want to interact with it later on in your
code.

Dim RectangelIndexE10E11 As Long
Dim RectangleNameE10E11 As String
With Range("E10:E11")
Worksheets(1).Shapes.AddShape msoShapeRectangle, _
.Left, .Top, .Width, .Height
RectangelIndexE10E11 = Shapes.Count
RectangleNameE10E11 = Shapes(Shapes.Count).Name
End With

Rick

"alstubna" wrote in message

...



Whithout going through a whole bunch of trial and error, how can I
easily
set
the co-ordinates to place an autoshape rectangle over specific cells
E10:E11?- Hide quoted text -


- Show quoted text -


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
AutoShape skid812pb Excel Discussion (Misc queries) 6 June 3rd 09 12:44 PM
autoshape tony Excel Discussion (Misc queries) 1 February 24th 07 09:35 PM
Autoshape jackietreehorn Excel Discussion (Misc queries) 2 November 6th 05 07:56 AM
NAME OF AUTOSHAPE Ronbo Excel Discussion (Misc queries) 3 August 18th 05 10:09 PM
AUTOSHAPE Glenn Excel Programming 4 May 12th 05 02:43 AM


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