Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    England
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    if yes if no (officexp 2002)

    i am trying to use if in the context of " IF " is what i am looking for, if it is there continue with the private sub and "IF" its not there return to the main programme
    can any one suggest a way forward as each time i try to do it the programme dosen't go any where. ??

    Private Sub NotAvailable()
    Selection.AutoFilter
    Selection.AutoFilter Field:=8, Criteria1:="#N/A"
    Application.ScreenUpdating = False
    If Value = 0 Then
    End If
    '################################################# ##################
    ' if criteria1 dose not exist return to main programme

    ' if criteria1 dose exist continue

    '################################################# #####

    Rows("1:1").Insert
    Range("M1").Value = "temp"
    With ActiveSheet
    .UsedRange
    lastrow = .Cells.SpecialCells(xlCellTypeLastCell).Row
    Set rng = Range("M1", Cells(lastrow, "M"))
    rng.AutoFilter Field:=8, Criteria1:="#N/A"
    rng.SpecialCells(xlCellTypeVisible).EntireRow.Sele ct
    .UsedRange.Copy
    End With
    Windows("comLoads.xls").Activate
    Range("A2").Select
    ActiveSheet.Paste
    Range("A2").Select
    Windows("LOADS.xls").Activate
    Range("A2646").Select
    Selection.AutoFilter Field:=8
    Selection.AutoFilter
    Cells.Replace What:="#N/A", Replacement:="D", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    Range("1:1").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = ""
    Selection.Delete Shift:=xlUp
    Range("A3").Select
    Selection.AutoFilter Field:=8, Criteria1:="D"
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    lastrow = ActiveSheet.UsedRange.Rows.Count
    For r = lastrow To 1 Step -1
    If UCase(Cells(r, 8).Value) = "D" Then Rows®.Delete
    Next r
    Application.ScreenUpdating = True

    End Sub

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: if yes if no (officexp 2002)

    To return to the calling procedure, use this:

    If expression then Exit Sub

Posting Permissions

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