A quick one I can't get my head round

  • Thread starter Crowbar via OfficeKB.com
  • Start date
C

Crowbar via OfficeKB.com

Hi experts
At the the moment this script keeps all data that is more that a 1000.
but I don't want to contain data greater than 99999

Help !!!

Dim rngTarget As Range
Dim lRow As Long
Dim lLastRow As Long

With Worksheets("OS")
lLastRow = .Cells(.Rows.Count, 8).End(xlUp).Row
For lRow = 1 To lLastRow
If Not .Cells(lRow, 8).Value > "1000" Then
If Not rngTarget Is Nothing Then
Set rngTarget = Application.Union(rngTarget, _
.Cells(lRow, 8).EntireRow)
Else
Set rngTarget = .Cells(lRow, 1).EntireRow
End If
End If
Next lRow
End With

If Not rngTarget Is Nothing Then
rngTarget.Delete shift:=xlUp
Set rngTarget = Nothing
End If
 
B

Bob Phillips

If .Cells(lRow, 8).Value < 1000 Then

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top