I'm trying to create a command button that when clicked, passes it's location through to the on click procedure (I eventually want to use it to delete the row that it is in). I supposedly can make use of ActiveSheet.Shapes(Application.Caller).TopLeftCell.Row to do this but I am getting an error. My procedure at the moment is as follows:
When I hit the button and the procedure is run, I get the error Run-time error '13' Type Mismatch.
I'm obviously doing something wrong here. Any assistance would be greatly appreciated.
Code:
Private Sub CommandButton1_Click()
MsgBox ("Row of pressed button: " & ActiveSheet.Shapes(Application.Caller).TopLeftCell.Row)
End Sub
When I hit the button and the procedure is run, I get the error Run-time error '13' Type Mismatch.
I'm obviously doing something wrong here. Any assistance would be greatly appreciated.