Hidden Sheets & Macros


Posted by dwayneiprolinktest on May 09, 2001 5:03 PM

I have a number of macros set up to run at the click of a button(s) that refer to other sheets in the workbook. I wish to hide these other sheets so that no one can see them but everytime I do this the macro doesn't work. How do I hide a sheet yet get the macro to work? Any help would be very much appreciated.

Posted by mseyf on May 09, 2001 6:38 PM

add a routine to your macro that turns off screen updating, un-hide the sheet, run the macro, hide the sheet, turn screen updating back on.

I'm not sure the syntax is exactly correct, but it would be something like:

application.screenupdating = false
sheets("sheet1").visible = true
***your macro here
sheets("sheet1").visible = false
application.screenupdating = true

HTH

Mark



Posted by Dave Hawley on May 10, 2001 4:53 AM

Hi

There should rarely be a need to have a sheet Visible or Active when running VBA code. What you need to do is write your code in such a way that no Selecting or Selection etc is in it.

You can as has been suggested resort to:

Application.ScreenUpdating=False
Sheet1.Visible=True
'Your Code
Sheet1.Visible=False
Application.ScreenUpdating=True


But the Sheet1.Visible code shouldn't be needed, unless printing.


Dave


OzGrid Business Applications