Thread: Hide Columns
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MrRJ MrRJ is offline
external usenet poster
 
Posts: 109
Default Hide Columns

Hi,
I referred back to another entry about hiding columns and tried to use it.
It didn't work. I created a drop down list in A5. Then all across from E1
to HE1, I used a simple if statement if the headers in row 6 equal to what
the selected drop down is, then is give value of 1, else blank. Question is,
why doesn't this work? Please help.

Dim c As Range
Dim varvalue As Variant
For Each c In Application.Intersect(ActiveSheet.UsedRange,
ActiveSheet.Range("E1:HI1")).Cells
varvalue = c.Value
If IsNumeric(varvalue) Then
If varvalue < 1 Then
c.EntireColumn.Hidden = True
End If
End If
Next c