ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   display userform (https://www.excelbanter.com/excel-discussion-misc-queries/132511-display-userform.html)

Anthony

display userform
 
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??


joel

display userform
 
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.

"Anthony" wrote:

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


Anthony

display userform
 
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
"Joel" wrote:

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.

"Anthony" wrote:

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


joel

display userform
 
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

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.

"Anthony" wrote:

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



All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com