Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Rows

Status
Not open for further replies.

Mattprd

IS-IT--Management
Mar 12, 2002
11
0
0
GB
I'm trying to hide rows where the cell value in column A is less than 2. Failing dismally with this so far, any ideas?


Columns(&quot;A:A&quot;).CellValue(<2).EntireRow.Hidden = True
 
Try something like this:
Code:
Sub HideRows()
    Dim iRow As Long
    iRow = 1    'start at first row
    Do While Cells(iRow, 1) <> &quot;&quot;
        If Cells(iRow, 1) < 2 Then
            Rows(iRow & &quot;:&quot; & iRow).Hidden = True
        End If
        iRow = iRow + 1
    Loop
End Sub
 
Thats perfect, thanks for your help
 
And...

since there is more than one way to skin a cat, here's a NON-VBA solution...

1. Turn on Auto Filter

2. In the Col A dropdown, select (Custom...)

3. In the Custom Auto Filter select &quot;is less than&quot; and in the adjacent dropdown enter &quot;2&quot;

VOLA! :) Skip,
metzgsk@voughtaircraft.com
 
No wonder I haven't seen too
many cats around here. [2thumbsup]
[machinegun][cat2]
 
All the icons indicate you liked the answers, so give the folks a STAR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top