SOLVED

When I click a cell, is it possible to move my shape at the bottom of that cell

Contributor

When I click a cell, is it possible to move my line shape right underneath that cell (with some VBA magic)?

 

rodsan724_0-1634562048441.png

 

2 Replies
best response confirmed by rodsan724 (Contributor)
Solution

@rodsan724 

Right-click the sheet tab.

Select 'View Code' from the context menu.

Copy the code listed below into the worksheet module.

Switch back to Excel.

Save the workbook as a macro-enabled workbook.

Make sure that you allow macros when you open the workbook.

P.S. if your sheet contains multiple shapes, you may have to change the index number 1 in Shapes(1).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    With Me.Shapes(1)
        .Top = Target.Top + Target.Height - .Height
    End With
End Sub

 

Wow! Thanks for this, really cool.