LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"