View Single Post
  #14   Report Post  
Bob Phillips
 
Posts: n/a
Default

The lines have got mixed up.

Try

Private Sub Workbook_Open()
With Sheets("ProcessA")
.Range("E3:M3").EntireColumn.Hidden = _
Not .Range("C4").Value = False
End With
End Sub

--

HTH

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


"Pennington" wrote in message
...
Willaim
I inserted
Private Sub Workbook_Open()
With Sheets("ProcessA").Range("E3:M3").EntireColumn.Hid den = Not
.Range("C4").Value = False
End With
But VBA does not like .Range
I am using Excel 2000.
Also if one can only hide complete rows or columns why is the range

("E3:M3")?


"William" wrote:

Very nice Bob!

For the benefit of the OP, I think you intended....

With Sheets("Sheet1")
..Range("E3:M3").EntireColumn.Hidden = Not .Range("C4").Value
End With

Note: C4 must contain either TRUE or FLASE (or be blank).
--

-----
XL2003
Regards

William



"Bob Phillips" wrote in message
...
simpler

Private Sub Workbook_Open()
Sheets("Sheet1").Range("E3:M3").EntireColumn.Hidde n = Not
.Range("C4").Value
End Sub

--

HTH

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


"William" wrote in message
...
Hi..

Private Sub Workbook_Open()
With Sheets("Sheet1")
.Range("E3:M3").EntireColumn.Hidden = False
If .Range("C4").Value = False Then _
.Range("E3:M3").EntireColumn.Hidden = True
End With
End Sub

-----
XL2003
Regards

William




"Pennington" wrote in message
...
I am trying to hide a range of cells when the value in another cell

is
FALSE
and show the range of cells when the value is TRUE. My code is as
follows
but
it doesn't work
Private Sub Workbook_Open()
If Range("C4").Value = False Then
Range("E4:M40").Hide = True
End If
If Range("C4").Value = True Then
Range("E4:M40").Unhide = False
End Sub

How do I make this work?