Forum Discussion
When I click a cell, is it possible to move my shape at the bottom of that cell
When I click a cell, is it possible to move my line shape right underneath that cell (with some VBA magic)?
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
2 Replies
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
- rodsan724Brass ContributorWow! Thanks for this, really cool.