View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Carim Carim is offline
external usenet poster
 
Posts: 510
Default how to prevent code running when in a worksheet code

Hi Corey,

I think I did not express myself clearly enough ...
With a test of your own ...
say if there is the number 1 in cell A1 then nothing happens,
otherwise your macro is executed ...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyRange As Range

If Range("A1").Value = 1 Then
Exit Sub
Else
If Not Intersect(Target, Range("C8:R30")) Is Nothing Then
Call frmCalendar.Show
End If
End If

End Sub

Hope this clarifies
Cheers
Carim