Oct 18 2021 06:01 AM
When I click a cell, is it possible to move my line shape right underneath that cell (with some VBA magic)?
Oct 18 2021 06:58 AM
SolutionRight-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
Oct 21 2021 05:33 AM
Oct 18 2021 06:58 AM
SolutionRight-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