Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#3
![]() |
|||
|
|||
![]()
Great! Thanks Dan.
Quote:
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditional Format as a MACRO | Excel Worksheet Functions | |||
Urgent date/scheduling calc needed | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Macro help - copy a cell down | Excel Discussion (Misc queries) | |||
macro help | Excel Discussion (Misc queries) |