Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rectangle Symbol | Excel Discussion (Misc queries) | |||
Rectangle Box | Excel Worksheet Functions | |||
Code to get a Range RECTangle or PT | Excel Programming | |||
Resizeable Rectangle | Excel Programming | |||
Add text to a rectangle in VBA | Excel Programming |