PDA

View Full Version : Solved: Hide Row Based On First Few Letters



agnesz
06-11-2008, 11:33 AM
I need to hide a row in a range (8:40000) if the cell in column B begins with 2<= 50%, or with 3<= 80%.

Also is there a way to hide all rows that are between the first row with 2<= 50% and last row with 3<= 80% (also first row with 4<= 100%).

THANKS SO MUCH!

Bob Phillips
06-11-2008, 11:46 AM
What the heck is ... cell in column B begins with 2<= 50%, or with 3<= 80% ... supposed to mean?

agnesz
06-11-2008, 11:59 AM
maybe its easier if I attach the file... the rows highlighted in yellow i would like hidden by running a macro, as would be using it on other reports...tx so much

Simon Lloyd
06-11-2008, 12:00 PM
Xld is right! (naturally) if a cell begins with 2<= 50% then its a string (text) not a formula is this correct? what did you want to hide? all rows that are between the values or including the values?

Simon Lloyd
06-11-2008, 12:01 PM
It would be easier if you attach a file!, maybe in the next post?

mdmackillop
06-11-2008, 12:39 PM
Hi Simon,
See post #3

Bob Phillips
06-11-2008, 01:26 PM
Sub DeleteRows()
Dim LastRow As Long
Dim i As Long

Application.ScreenUpdating = False

With ActiveSheet

LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = LastRow To 1 Step -1

If .Cells(i, "B").Value Like "2<= 50%*" Or _
.Cells(i, "B").Value Like "3<= 80%*" Then

.Rows(i).Hidden = True
End If
Next i
End With

Application.ScreenUpdating = True
End Sub

Simon Lloyd
06-11-2008, 02:33 PM
Hi Simon,
See post #3lol Malcolm, that was an edit after i posted!

agnesz
06-17-2008, 06:57 AM
YOU GUYS ROCK!

:bow: