How does this work?

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

How does this work?

Post by VegasNath »

Code: Select all

Sub Show_All()

    Rows.Hidden = Fales
    
End Sub
:conused:
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78544
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How does this work?

Post by HansV »

Does it literally have "Fales" or is that a typo?
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: How does this work?

Post by VegasNath »

No, it works with fales. It also works with fale.
:wales: Nathan :uk:
There's no place like home.....

User avatar
StuartR
Administrator
Posts: 12615
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: How does this work?

Post by StuartR »

Most odd, even though I have
Option Explicit
at the beginning of this module, it still accepts this as valid...
You do not have the required permissions to view the files attached to this post.
StuartR


User avatar
HansV
Administrator
Posts: 78544
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How does this work?

Post by HansV »

I still think it has to do with the lack of Option Explicit. If the variable Fales is not declared, its default value is Null, which in many situations is treated the same as 0, "" and False.

I do get an error message:
x459.jpg
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: How does this work?

Post by Don Wells »

I am running 2003 SP 3 and Nathan's code makes all hidden rows visible on the active sheet on my machine. Go figure.
Regards
Don

User avatar
HansV
Administrator
Posts: 78544
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How does this work?

Post by HansV »

Do you have Option Explicit at the top of the module?
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: How does this work?

Post by Don Wells »

HansV wrote:Do you have Option Explicit at the top of the module?
With "Option Explicit" the code will not run.
Without "Option Explicit" the code interprets "Fales" as "False".
Regards
Don

User avatar
HansV
Administrator
Posts: 78544
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How does this work?

Post by HansV »

That's to be expected, as I explained higher up in this thread.

I'd like to point readers of this thread to The importance of 'Option Explicit'. It really is important to require variables to be declared explicitly!
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: How does this work?

Post by VegasNath »

HansV wrote:That's to be expected, as I explained higher up in this thread.

I'd like to point readers of this thread to The importance of 'Option Explicit'. It really is important to require variables to be declared explicitly!
Ahem, yes, point taken! :grin:

:thankyou: all.
:wales: Nathan :uk:
There's no place like home.....