"Hide" running Macro

brites

Board Regular
Joined
Aug 19, 2004
Messages
224
Hi folks,
I have a macro that hide/unhide columns upon certain variables.
My concern is with the appearance of it... while the macro is running, columns keep "moving" across the spreadsheet... is there anyway to hide this effect and only show me the final results?

Thanx in advance!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try entering
Code:
Application.ScreenUpdating = False
as the first line of your macro

JB
 
Upvote 0
Don't forget to add
Code:
Application.ScreenUpdating = true
at the end of the macro. It's not really required, but it helps proper coding by pairing up on/off instructions.
 
Upvote 0
Smitty, does setting it back to true actually serve any purpose? I've never used it, and haven't noticed any problems.
 
Upvote 0
There are two reasons why you should set it back to true when it's no longer needed:
1. It proves to be a pain when you want to test a macro step by step and you cannot see anything happening just because you forgot to re-enable screen updating.
2. It helps learning how to code "properly". It's like when you learn to write. If you forget to close a parenthesis once, nothing happens, but if you just catch the habit, that one time when you really need it will turn into a disaster.
I think about it this way:
You can start by not setting back Screen Updating to true, then you don't set Application.DisplayAlerts back to true and then you spend hours searching through your code for a problem that doesn't even exists, just because you forgot to "close the parenthesis" :)
 
Upvote 0
Fair comment, I've not had that problem yet, but maybe it's just my way of doing things.

Would say I'm perfect and don't make errors but doubt you would believe me :)
 
Upvote 0
Smitty, does setting it back to true actually serve any purpose? I've never used it, and haven't noticed any problems.

Yes, because the VBE won't turn it back on for you. Same with EnableEvents as war4peace pointed out.
 
Upvote 0

Forum statistics

Threads
1,222,143
Messages
6,164,180
Members
451,880
Latest member
2da

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top