Thread
:
Hide Columns
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Hide Columns
why not a simpler approach
Sub hidecolsif()
For Each c In Range("e1:hl1")
If c = 1 Then Columns(c.Column).Hidden = True
Next c
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"MrRJ" wrote in message
...
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
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett