excel hiddden rows and colums - one last question

  • Thread starter Thread starter Nils
  • Start date Start date
N

Nils

I used the following information from
Earl Kiosterud
mvpearl omitthisword at verizon period net
and it is excellent for rows and colums to be hidden if a
value is entered into a cell.

However, one last question, how do I use it together on
the same sheet to hide a row and colum at the same time?

=====================================================
Private Sub Worksheet_Change(ByVal Target As Range)
Set TestCell = Range("J5")
TestValue = "stuff"
If TestCell = TestValue Then
Range("B1").EntireColumn.Hidden = True
Else
Range("B1").EntireColumn.Hidden = False
End If
End Sub
========================================================
 
Nils,

Try the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim TestCell As Range
Dim TestValue As Variant
Set TestCell = Range("J5")
TestValue = "stuff"
If TestCell = TestValue Then
Range("B1").EntireColumn.Hidden = True
Range("B1").EntireRow.Hidden = True
Else
Range("B1").EntireColumn.Hidden = False
Range("B1").EntireRow.Hidden = False
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
Back
Top