display userform

A

Anthony

Hi
I have created a very simple userform which I want to be displayed each time
any cell is used. I have tried typing this code..

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
Roulette.Show

Application.EnableEvents = True
End Sub

in the worksheet code module, but when I hit the enter key after adding some
data into any cell the user form doesn't show

any ideas why??
 
J

Joel

The same thing happened to me this morning. The Worksheet_Change functtion
doesn't reference Target, thereofre it doesn't get called. try adding to the
routine
msgbox(Target). I bet this will work.
 
A

Anthony

Sorry Joel I am new to user forms
where do I place
msgbox(Target).
into my code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Roulette.Show
Application.EnableEvents = True
End Sub

thanks
 
J

Joel

I thiink the problem is the code is in the wrong place. In VBA go to the
View Menu and select Project explorer if it iis not opened.

Select the workbook you are using. The worksheet change should be in the
Worksheett where you are making the change. Not in any Module.

Copy the worksheet_Change function. Then go to the worksheet in excel. On
the tab on the bottom of the worksheet (for example sheet1) right click the
tab and slect code. This should open the correct module in VBA were you need
to place the code. Paste the code on this sheet in VBA.

This is just to verify the problem


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
msgbox(Target)
Application.EnableEvents = False
Roulette.Show
Application.EnableEvents = True
End Sub
 
Top