Home > Enterprise >  Showing a Shape based on selecting specified cell
Showing a Shape based on selecting specified cell

Time:12-25

I want to showing a shape (scrollbar) based on just selecting a specified cell. I wrote below code but it doesn't work:

If Range("A1").Select Then
  ActiveSheet.Shapes("ScrollBar_1").Visible = True
End If

and also the Shape should be hide after Deselecting the cell.

Any idea is welcome.

Thanks

CodePudding user response:

This should do it and must be put in the worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)


If Not Intersect(Target, Range("A1")) Is Nothing Then 'Change A1 by the cell you want

ActiveSheet.Shapes("ScrollBar_1").Visible = True

Else

ActiveSheet.Shapes("ScrollBar_1").Visible = False

End If

End Sub
  • Related