Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default how to verify a sheet.visible = true?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default how to verify a sheet.visible = true?

sheets("x").visible = false 'I'd use xlsheethidden

should work.

If the sheet is already hidden, it just won't do anything noticeable.

If the sheet is visible, then it should be hidden.

But there are some cases where you can't hide the sheet.

Is this the only visible sheet in the workbook? Every workbook has to have at
least one visible sheet.

Is this the workbook's structure protected?
(via Tools|protection|Protect workbook in xl2003 menus)

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.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default how to verify a sheet.visible = true?

With you input on should be elsewhere I took a deeper look and find out that
I am using a variable to store the sheet name but maybe it is not initiated
yet when I am trying to hide it.... how can I initiate a variable defined as
worksheet so if I want to close it before I use it it will not fail?

"Mike H" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visible = True - Not Working Minitman Excel Programming 4 September 4th 08 11:11 PM
For...Loop to verify at least one checkbox = True RyanH Excel Programming 2 May 13th 08 03:43 PM
Set Visible Cells To TRUE Kevin H. Stecyk Excel Programming 6 February 3rd 08 06:51 PM
TextBox.Visible = True ... not working Ozgur Pars[_2_] Excel Programming 3 April 16th 07 10:16 AM
ActiveWindow.Visible = True Paulo Alexandre ( PT ) Excel Programming 5 September 29th 06 12:02 PM


All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"