+ Reply to Thread
Results 1 to 3 of 3

A quick one I can't get my head round

  1. #1
    Crowbar via OfficeKB.com
    Guest

    A quick one I can't get my head round

    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


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200510/1

  2. #2
    Bob Phillips
    Guest

    Re: A quick one I can't get my head round


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

    --

    HTH

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


    "Crowbar via OfficeKB.com" <u15117@uwe> wrote in message
    news:567a88492e1e7@uwe...
    > 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
    >
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200510/1




  3. #3
    Crowbar via OfficeKB.com
    Guest

    Re: A quick one I can't get my head round

    Its OK Now

    I've figured it out


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200510/1

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1