Identifying an autoshape by row

Steeviee

Active Member
Joined
Sep 9, 2009
Messages
380
Hello Gang,

I'm not even sure that this is possible but here goes.

I have a macro that, if a date that is late to schedule is entered, puts a nice big black arrow onto that line and formats some boxes to the right (where the arrow is pointing) to show that more data is required. All well and good.

I have been asked to now alter this so that when a late date is changed and so is now forecast to be on time, the boxes to the right disappear (pretty easy as it's just formatting) and the arrow disappears...

Now I'm in trouble. When I record macros to delete or hide the autoshape, it always refers to it by number...

Code:
ActiveSheet.Shapes("AutoShape 16").Select
    Selection.Delete

is there any way to refer to it by location? The macro is a Private Sub Worksheet_Change(ByVal Target As Range) type and I define the row number. Can I identify the shape that's located in this row to delete or hide? When I create the autoshape, can I name it referring to the row, maybe?

Many thanks in advance - I hope that you can help, even if if it's just to confirm my fear that it won't work.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Ignore me - I was thinking about naming the shape as I was writing the post. I now name the shape "Arr" & RR (where RR is my row number) when creating and I can then delete it no trouble ...
 
Upvote 0
Just a thought:-
This code will Hide any shape that is in the same row as the row that is selected for change.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
    If Target.Row = Shp.TopLeftCell.Row Then
        Shp.Visible = False
    Else
        Shp.Visible = True
    End If
Next Shp
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,147
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top