Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Doesn't Recognize/Find Rectangle

Am using the following code in a worksheet module (to attach an object to the
cell when it is active); however, it comes back with a message that says
"item with the specified name wasn't found". I don't know why this is
happening, as I can see the item on the worksheet itself and the name is
correct (Rectangle 87). Moreoever, I have exactly the same code in the
module for another sheet in this workbook, but with different rectangle
names, and they work fine. Any ideas on what is going on here?

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box87 As Shape
Set Box87 = Me.Shapes("Rectangle 87")

If Not (Intersect(Target, Range("M2:M50")) Is Nothing) Then
With Target
Shapes("Rectangle 87").Visible = True
If Selection.Left + Selection.Width + Box87.Width Rows(1).Width Then
Box87.Left = Selection.Left - Box87.Width
Else: Box87.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height + Box87.Height
Columns(1).Height Then
Box87.Top = Selection.Top - Box87.Height
Else: Box87.Top = Selection.Top + Selection.Height
End If
Box87.ZOrder msoBringToFront
End With
Else: Shapes("Rectangle 87").Visible = False
End If
End Sub
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
Rectangle Symbol cs_jono Excel Discussion (Misc queries) 3 April 25th 08 09:29 PM
Rectangle Box Keyrookie Excel Worksheet Functions 1 January 27th 08 08:09 AM
Code to get a Range RECTangle or PT keepITcool Excel Programming 6 August 12th 05 06:54 PM
Resizeable Rectangle Bill Bell Excel Programming 1 October 27th 03 08:34 PM
Add text to a rectangle in VBA pk Excel Programming 2 October 19th 03 02:44 AM


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