PDA

View Full Version : Solved: hide columns based on value



agnesz
08-01-2007, 09:29 AM
How can I ask Excel to hide columsn based on the value in row 6? Basically anytime the word "MCF" shows up in row 6, the whole column should be hidden.
Data range is from column A to AK.
Thank you!

Bob Phillips
08-01-2007, 10:37 AM
Sub HideData()
Dim mpLastCol As Long
Dim i As Long

With ActiveSheet

mpLastCol = .Cells(6, .Columns.Count).End(xlToLeft).Column
For i = 1 To mpLastCol
.Columns(i).Hidden = .Cells(6, i).Value = "MCF"
Next i
End With

End Sub

agnesz
08-02-2007, 06:22 AM
brilliance
thank you

anandbohra
08-02-2007, 11:57 PM
kindly mark your thread as solved the moment u got acceptable reply as it saves time in looking thread which r already been solved.

so pl from next time mark thread as solved as u get required reply.

this option is located in the thread tools.