View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default how to verify a sheet.visible = true?

Hi,

If sheets("X") is already hidden then making it hidden again won't cause an
error so your problem lies elsewhere.

I'm suspicious of the sheet("X").visible in your question. Because the X is
in quotes it becomes a string and therefore the name of the worksheet, do you
really mean something like this:

For X = 2 To Worksheets.Count
If Sheets(X).Visible Then
Sheets(X).Visible = False
End If
Next

In this case if the sheet is visible it hides it because now X is a variable.

Mike

"Alberto Ast" wrote:

I need to check if a sheet("X").visible is true or false
I mean if the specified sheet is visible I want to make it false but right
now it is failing in my macro because if it is false already it fail.