enabling/disabling a set of code from within a spreadsheet sheet

R

Roger on Excel

I have some visual basic code on a sheet which i use to provide a certain
layout of the sheet for printing.

The nature of the code is complicated and slows the spreadsheet down when i
am editing it.

Is there an easy way to deactivate the code temporarily so that i can edit
the spreadsheet without the code being active?

At present i have to manually delete the entire code and then re paste it to
reactivate it.

It would be great if i could set up a macro such that I could push a button
on the sheet to deactivate and activate the code
 
T

Tim Zych

Aside from creating a flag and adding to the macro, you could just click the
Design Mode icon on the Visual Basic toolbar, which won't allow code to run,
then exit design mode when the macros should run.
 
G

Gord Dibben

Maybe disable events while you are editing.

Sub disable_events()
Application.EnableEvents = False
End Sub

Do your editing here then..........

Sub enable_events()
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 

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

Top