I'm trying to do something very simple in Excel using VBA. In the worksheet, I have several textboxes (shapes). I just want to get the value and the color code of the shape that the user selects by mouse clicks. And when the box is moved, I also want to get the position of the box. Is this possible?
I tried the following, but not sure if this is the way to do. I suppose what I'm missing is which function to use to consistently monitor the sheet.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sr As Variant
Set sr = Selection.ShapeRange
If Not sr Is Nothing Then
MsgBox "selecting box"
End If
End Sub
I also tried using Worksheet_Activate(), but it does something only when the user activates the sheet.
