Problem displaying a UserForm

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
 
R

Rick Rothstein

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
 
P

Pats

I also tried creating a general decleration module

Public bSELCTIONCHANGE As Boolean

and adding the line :

If bSELCTIONCHANGE Then to my code
 
B

Bob Phillips

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top