Thread: Sheet code
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
gareth gareth is offline
external usenet poster
 
Posts: 37
Default Sheet code

Bob

names are correct but fotgot to mention that I'm on '97 (I
know there is a problem with the change event in '97 but
it seems to fire OK)

another funny thing, another cell has 3 sheets appear
when "Y" is selected and it works fine!

-----Original Message-----
Gareth,

I tried it and it works fine for me. Are you sure that

the sheets are called
sheet1 and sheet2?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gareth" wrote in

message
...
I am struggling with some change event sheet code. I

have
a data validation list in a cell and when I pick "Y"

from
this list I want 2 hidden worksheets to become visible.
For some reason one of the sheets appears but not the
other, this is what I am using:

Private Sub Worksheet_Change(ByVal Target As

Excel.Range)
If Range("C20").Value = "Y" Then
Sheets("sheet1").Visible = True
Sheets("sheet2").Visible = True
Else
Sheets("sheet1").Visible = False
Sheets("sheet2").Visible = False
End If
End Sub

Any help gratefully received.

Gareth



.