hide sheets doesn`t work due to macro

  • Thread starter Thread starter markymark
  • Start date Start date
M

markymark

Hi,

I have some trouble with a macro.
I have built a workbook with macro`s in it and a frontpage sheet wich
links to them all.
Now the problem, I really want to hide all sheets except the
frontpagesheet, unfortunaly the macro`s give a runtime error when I
hide them.
Does any one have a code for this, which i can use?
 
Marky,

I think we need to see the code, because what you are asking is
straight-forward enough.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Mark,

You cant access sheets that are hidden. You have to unhide them first,
then access them, then close them. You can do this all in the macro
like this:

Worksheets("YourWorksheet").Visible = True
macro.....etc
Worksheets("YourWorksheet").Visible = False

You should also add something at the very beginning of the code as
below, to stop the screen flickering:

Application.ScreenUpdating = False


Hope this helps

DF.
 
So, if I`m correct you mean:

First Hide all the sheets,
Then go to your frontpage and make new macro`s for each sheet you want
to link to, which goes like:
record new macro, unhide sheet I want to open, set mouse in first cell
and then stop record. Asign macro to front sheet.
Do that for all links...
But how do i hide them all again>?
 
Actually, you can do lots of things to a hidden worksheet. You can change
values, formats--lots of stuff.

You can't select it or print it, though.
 
At least one worksheet has to be visible. So make sure FrontPage is visible
before you try to hide the others:

Option Explicit
Sub testme()

Dim wks As Worksheet
Worksheets("frontpage").Visible = xlSheetVisible

For Each wks In Worksheets
If LCase(wks.Name) = LCase("frontpage") Then
'do nothing
Else
wks.Visible = xlSheetHidden
End If
Next wks

End Sub

If that wasn't the problem, then post your code and how you're running it
(commandbutton, tools|macro)
 
Back
Top