ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Urgent - VBA Code Not Running (https://www.excelbanter.com/excel-programming/374499-urgent-vba-code-not-running.html)

x-rays

Urgent - VBA Code Not Running
 
Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?


[email protected]

Urgent - VBA Code Not Running
 
Can you post the code?

x-rays wrote:
Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?



Alok

Urgent - VBA Code Not Running
 
Usually that happens when the Application.EnableEvents is turned off.
To check just go to the immediate window and type
? Application.EnableEvents

"x-rays" wrote:

Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?



NickHK[_3_]

Urgent - VBA Code Not Running
 
I guess it would on your code.

NickHK

"x-rays"
groups.com...
Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?




Jim Thomlinson

Urgent - VBA Code Not Running
 
Hard to say from your limited description but my best guess would be that
your code probably toggles Application.EnableEvents on and off. If your code
turns events off and does not turn them back on again then No events will be
firing. Try running this little procedure and see if it helps

Sub ReEnable()
Application.EnableEvents = True
end sub

If that fixes your problems then you need to find out why your events were
turned off without being turned on again. If you need help with that just
reply back...
--
HTH...

Jim Thomlinson


"x-rays" wrote:

Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?



x-rays

Urgent - VBA Code Not Running
 
Now says that I have to enable the macros and refer to online help

Jim Thomlinson wrote:
Hard to say from your limited description but my best guess would be that
your code probably toggles Application.EnableEvents on and off. If your code
turns events off and does not turn them back on again then No events will be
firing. Try running this little procedure and see if it helps

Sub ReEnable()
Application.EnableEvents = True
end sub

If that fixes your problems then you need to find out why your events were
turned off without being turned on again. If you need help with that just
reply back...
--
HTH...

Jim Thomlinson


"x-rays" wrote:

Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?




x-rays

Urgent - VBA Code Not Running
 
Ok guys it works with the Application.EnableEvents = True

I had first to close and reopen the file.

Thank you all very very much!

Have a nice day (or night)!

x-rays wrote:
Now says that I have to enable the macros and refer to online help

Jim Thomlinson wrote:
Hard to say from your limited description but my best guess would be that
your code probably toggles Application.EnableEvents on and off. If your code
turns events off and does not turn them back on again then No events will be
firing. Try running this little procedure and see if it helps

Sub ReEnable()
Application.EnableEvents = True
end sub

If that fixes your problems then you need to find out why your events were
turned off without being turned on again. If you need help with that just
reply back...
--
HTH...

Jim Thomlinson


"x-rays" wrote:

Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?





All times are GMT +1. The time now is 10:38 PM.

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