display userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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??
 
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.
 
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
 
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
 

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

Back
Top