Problem displaying a UserForm

  • Thread starter Thread starter Pats
  • Start date Start date
P

Pats

Can anyone tell me why this code is not displaying my UserForm?

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("D7:Y7000")) Is Nothing Then
UserForm2.Show
End If


End Sub
 
Another possibility... did you by any chance turn off events during your
coding session (either accidentally or on purpose)? Try executing this
statement in the Immediate window and see if that straightens things out...

Application.EnableEvents=True
 
I also tried creating a general decleration module

Public bSELCTIONCHANGE As Boolean

and adding the line :

If bSELCTIONCHANGE Then to my code
 
Then try

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("D7:Y7000")) Is Nothing Then
UserForm2.Show
End If


End Sub
 
Back
Top