View Single Post
  #3   Report Post  
Michael Excel Dude Michael Excel Dude is offline
Junior Member
 
Posts: 12
Default

Great! Thanks Dan.



Quote:
Originally Posted by Dan Hatola
You can use the worksheet_selectionchange event to track when the cell is
entered. It should be placed on the worksheet module for the sheet of
interest.
I am assuming that your worksheet is protected and some of the cells are
locked while others are not.

If you want it to work for any cell on the worksheet, try:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Locked = True Then
Call Sub1
Else
Call Sub2
End If
End Sub

If you want it to work for a specific cell you can use:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$6" Then
If Target.Locked = True Then
Call Sub1
Else
Call Sub2
End If
End If
End Sub

Best,
Dan


"Michael Excel Dude" wrote:


Probably a simple thing for a lot of you, but can anyone give me the
code to run a macro on cell entry:

1. If the cell is unprotected
2. If the cell is protected

Thanks!

Michael




--
Michael Excel Dude