Macro to run when cell click

B

Brad

I'm trying to write a macro to call a userform when you click in a cell. This
is what i've got which works when someone types a character in the cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$5" Then
userform1.show
End If
End Sub

Any way to change this so the form is called when the cell is selected?
 
J

JLGWhiz

Just make it SelectionChange should work.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$5" Then
userform1.show
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top