ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Enabling/Disabling Macros w/o closing & re-opening (https://www.excelbanter.com/excel-programming/371830-enabling-disabling-macros-w-o-closing-re-opening.html)

Conan Kelly

Enabling/Disabling Macros w/o closing & re-opening
 
Hello all,

Is there a way to enable and disable macros without having to close the file and re-open it?

One of the files that my boss has designed has macros running when you switch from tab to tab, making it impossible to copy-&-paste
from sheet to sheet. I would like to be able to disable macros, do my copy & paste, and then re-enable macros without having to
close my file. Is this possible?

--
Thanks for any help anyone can provide,

Conan Kelly



Jim Thomlinson

Enabling/Disabling Macros w/o closing & re-opening
 
What you could do would be to disable event (keeping the code from running
when you switch from tab to tab. You could then do your copying and pasting
without issue. The code to turn off events is this (which you could attach to
a button)

sub DisableEvents
application.enableevents = false
end sub

sub ReEnableEvents
application.enableevents = true
end sub

You MUST MUST MUST make sure to re-eneable events when you are finished,
otherwise events will be PERMANENTLY disabled on your machine until you run
code to switch the events back. Nothing including rebooting will not turn the
events back on. Only code.
--
HTH...

Jim Thomlinson


"Conan Kelly" wrote:

Hello all,

Is there a way to enable and disable macros without having to close the file and re-open it?

One of the files that my boss has designed has macros running when you switch from tab to tab, making it impossible to copy-&-paste
from sheet to sheet. I would like to be able to disable macros, do my copy & paste, and then re-enable macros without having to
close my file. Is this possible?

--
Thanks for any help anyone can provide,

Conan Kelly





All times are GMT +1. The time now is 11:13 PM.

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