ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to run when cell click (https://www.excelbanter.com/excel-programming/418334-macro-run-when-cell-click.html)

Brad

Macro to run when cell click
 
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?


JLGWhiz

Macro to run when cell click
 
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


"Brad" wrote:

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?



All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com