Hi,
Is it possible to edit this code so that the lines will meet each other on the left side, not the right side?
Is it also possible to make a code for just the bottom line?
Regards
Is it possible to edit this code so that the lines will meet each other on the left side, not the right side?
Is it also possible to make a code for just the bottom line?
Regards
VBA Code:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("A1:CF300")) Is Nothing Then ' < this is the range where you want the lines to be
With ActiveSheet.Shapes("Down Arrow 1")
.Visible = True ' make the line visible
.Left = Target.Left + Target.Width
.Top = 0 ' very top of worksheet
.Width = 3 ' width of line
.Height = Rows("1:" & Target.Row).Height
End With
With ActiveSheet.Shapes("Right Arrow 1")
.Visible = True ' make the line visible
.Left = 0 ' very left of worksheet
.Top = Target.Top + Target.Height
.Width = Range(Cells(Target.Row, 1), Cells(Target.Row, Target.Column)).Width
.Height = 3 ' width of the line
End With
Else
ActiveSheet.Shapes("Down Arrow 1").Visible = False ' hide the lines if out of range
ActiveSheet.Shapes("Right Arrow 1").Visible = False ' hide the lines if out of range
End If
On Error GoTo 0
End Sub