Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default hiding sheets

I have a box in sheet named "General INFO"

If an "X" or "x" is entered into this box, then a hidden sheet named "Detail
INFO" becomes visible.

The code looks like this:

If Sheets("General INFO").Range("H45").Value = "X" Then
Sheets("Detail INFO").Visible = True
Else: Sheets("Detail INFO").Visible = False
End If

First, I don't knwo how to include "x" as well as "X"

Second, what sub do i put this under? there is no button to activate, i
just want this to always apply to the sheet. like as soon as x is entered,
the sheet is visible.

I was using
Private Sub Worksheet_Change(ByVal Target As Range)

but this created an error when i typed in other cells besides H45. This
probably easy for you guys, but i'm pretty new at this.

Thanks for any help
Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default hiding sheets

Hi Steve,

Try:

'==============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then
Sheets("Detail INFO").Visible = LCase(rng.Value) = "x"
End If

End Sub
'<<==============

---
Regards,
Norman


"steve" wrote in message
...
I have a box in sheet named "General INFO"

If an "X" or "x" is entered into this box, then a hidden sheet named
"Detail
INFO" becomes visible.

The code looks like this:

If Sheets("General INFO").Range("H45").Value = "X" Then
Sheets("Detail INFO").Visible = True
Else: Sheets("Detail INFO").Visible = False
End If

First, I don't knwo how to include "x" as well as "X"

Second, what sub do i put this under? there is no button to activate, i
just want this to always apply to the sheet. like as soon as x is
entered,
the sheet is visible.

I was using
Private Sub Worksheet_Change(ByVal Target As Range)

but this created an error when i typed in other cells besides H45. This
probably easy for you guys, but i'm pretty new at this.

Thanks for any help
Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default hiding sheets

Norm,

That works perfect. If you don't mind, can you just explain the logic in
what you did. if you dont' have time, that's fine. i'm just trying to get
better at this stuff. i'm not sure exactly what you did.

either way, thanks a lot
steve

"Norman Jones" wrote:

Hi Steve,

Try:

'==============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then
Sheets("Detail INFO").Visible = LCase(rng.Value) = "x"
End If

End Sub
'<<==============

---
Regards,
Norman


"steve" wrote in message
...
I have a box in sheet named "General INFO"

If an "X" or "x" is entered into this box, then a hidden sheet named
"Detail
INFO" becomes visible.

The code looks like this:

If Sheets("General INFO").Range("H45").Value = "X" Then
Sheets("Detail INFO").Visible = True
Else: Sheets("Detail INFO").Visible = False
End If

First, I don't knwo how to include "x" as well as "X"

Second, what sub do i put this under? there is no button to activate, i
just want this to always apply to the sheet. like as soon as x is
entered,
the sheet is visible.

I was using
Private Sub Worksheet_Change(ByVal Target As Range)

but this created an error when i typed in other cells besides H45. This
probably easy for you guys, but i'm pretty new at this.

Thanks for any help
Steve




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default hiding sheets

Hi Steve

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then


The above lines are intended to limit macro action to changes in the H45
cell.
I would have liked to say:

If Intersect(rng, Target) Is Something Then

but the keyword something does not exist. Since, however, the keyword
Nothing does exist, I use this with a double negative to obtain a valid
equivalent expression.

Sheets("Detail INFO").Visible = LCase(rng.Value) = "x"


By comparing the lower case value of H45 with the lower case x, the code
allows for either upper or lower case values.

The right-hand side of the above equality expression returns either true or
false and, therefore, toggles the visible property of the Detail Info sheet.

---
Regards,
Norman


"steve" wrote in message
...
Norm,

That works perfect. If you don't mind, can you just explain the logic in
what you did. if you dont' have time, that's fine. i'm just trying to
get
better at this stuff. i'm not sure exactly what you did.

either way, thanks a lot
steve

"Norman Jones" wrote:

Hi Steve,

Try:

'==============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then
Sheets("Detail INFO").Visible = LCase(rng.Value) = "x"
End If

End Sub
'<<==============

---
Regards,
Norman


"steve" wrote in message
...
I have a box in sheet named "General INFO"

If an "X" or "x" is entered into this box, then a hidden sheet named
"Detail
INFO" becomes visible.

The code looks like this:

If Sheets("General INFO").Range("H45").Value = "X" Then
Sheets("Detail INFO").Visible = True
Else: Sheets("Detail INFO").Visible = False
End If

First, I don't knwo how to include "x" as well as "X"

Second, what sub do i put this under? there is no button to activate,
i
just want this to always apply to the sheet. like as soon as x is
entered,
the sheet is visible.

I was using
Private Sub Worksheet_Change(ByVal Target As Range)

but this created an error when i typed in other cells besides H45.
This
probably easy for you guys, but i'm pretty new at this.

Thanks for any help
Steve






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default hiding sheets

Norman,

Thanks for the thorough explanation. The only syntax i still don't
understand is the Me.Range what is the Me?

"Norman Jones" wrote:

Hi Steve

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then


The above lines are intended to limit macro action to changes in the H45
cell.
I would have liked to say:

If Intersect(rng, Target) Is Something Then

but the keyword something does not exist. Since, however, the keyword
Nothing does exist, I use this with a double negative to obtain a valid
equivalent expression.

Sheets("Detail INFO").Visible = LCase(rng.Value) = "x"


By comparing the lower case value of H45 with the lower case x, the code
allows for either upper or lower case values.

The right-hand side of the above equality expression returns either true or
false and, therefore, toggles the visible property of the Detail Info sheet.

---
Regards,
Norman


"steve" wrote in message
...
Norm,

That works perfect. If you don't mind, can you just explain the logic in
what you did. if you dont' have time, that's fine. i'm just trying to
get
better at this stuff. i'm not sure exactly what you did.

either way, thanks a lot
steve

"Norman Jones" wrote:

Hi Steve,

Try:

'==============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then
Sheets("Detail INFO").Visible = LCase(rng.Value) = "x"
End If

End Sub
'<<==============

---
Regards,
Norman


"steve" wrote in message
...
I have a box in sheet named "General INFO"

If an "X" or "x" is entered into this box, then a hidden sheet named
"Detail
INFO" becomes visible.

The code looks like this:

If Sheets("General INFO").Range("H45").Value = "X" Then
Sheets("Detail INFO").Visible = True
Else: Sheets("Detail INFO").Visible = False
End If

First, I don't knwo how to include "x" as well as "X"

Second, what sub do i put this under? there is no button to activate,
i
just want this to always apply to the sheet. like as soon as x is
entered,
the sheet is visible.

I was using
Private Sub Worksheet_Change(ByVal Target As Range)

but this created an error when i typed in other cells besides H45.
This
probably easy for you guys, but i'm pretty new at this.

Thanks for any help
Steve








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default hiding sheets

'Me' refers to the object which contains the code. Since the code
is in a sheet's code module, Me refers to that worksheet. If 'Me'
appears in a userform's code module, it would refer to the
userform.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"steve" wrote in message
...
Norman,

Thanks for the thorough explanation. The only syntax i still
don't
understand is the Me.Range what is the Me?

"Norman Jones" wrote:

Hi Steve

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then


The above lines are intended to limit macro action to changes
in the H45
cell.
I would have liked to say:

If Intersect(rng, Target) Is Something Then

but the keyword something does not exist. Since, however, the
keyword
Nothing does exist, I use this with a double negative to
obtain a valid
equivalent expression.

Sheets("Detail INFO").Visible = LCase(rng.Value) =
"x"


By comparing the lower case value of H45 with the lower case
x, the code
allows for either upper or lower case values.

The right-hand side of the above equality expression returns
either true or
false and, therefore, toggles the visible property of the
Detail Info sheet.

---
Regards,
Norman


"steve" wrote in message
...
Norm,

That works perfect. If you don't mind, can you just explain
the logic in
what you did. if you dont' have time, that's fine. i'm
just trying to
get
better at this stuff. i'm not sure exactly what you did.

either way, thanks a lot
steve

"Norman Jones" wrote:

Hi Steve,

Try:

'==============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("H45")

If Not Intersect(rng, Target) Is Nothing Then
Sheets("Detail INFO").Visible = LCase(rng.Value) =
"x"
End If

End Sub
'<<==============

---
Regards,
Norman


"steve" wrote in message
...
I have a box in sheet named "General INFO"

If an "X" or "x" is entered into this box, then a hidden
sheet named
"Detail
INFO" becomes visible.

The code looks like this:

If Sheets("General INFO").Range("H45").Value = "X" Then
Sheets("Detail INFO").Visible = True
Else: Sheets("Detail INFO").Visible = False
End If

First, I don't knwo how to include "x" as well as "X"

Second, what sub do i put this under? there is no button
to activate,
i
just want this to always apply to the sheet. like as
soon as x is
entered,
the sheet is visible.

I was using
Private Sub Worksheet_Change(ByVal Target As Range)

but this created an error when i typed in other cells
besides H45.
This
probably easy for you guys, but i'm pretty new at this.

Thanks for any help
Steve








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
Hiding Sheets ArcticWolf Excel Discussion (Misc queries) 1 November 14th 07 11:40 AM
hiding zero values on all sheets & by default on new sheets WiFiMike2006 Excel Worksheet Functions 4 January 19th 07 08:13 PM
Locking Sheets / Hiding Sheets Lee Harris Excel Worksheet Functions 4 November 29th 05 07:21 AM
Hiding Sheets Rain Excel Worksheet Functions 10 January 18th 05 08:11 PM
Hiding Sheets Eric[_14_] Excel Programming 4 November 26th 03 06:38 PM


All times are GMT +1. The time now is 02:18 AM.

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

About Us

"It's about Microsoft Excel"