1

i have recently added the below piece of code in my macro to sort/filter a sheet and find a particular value and apply some formating based on the value found cell

  Sheets("Extract").Select
    Range("A1").Select
    Selection.AutoFilter
    Selection.AutoFilter


' finding the yesterday last resolved(on same day) ticket
Range("A1:AB2164").Select
    ActiveWorkbook.Worksheets("Extract").Sort.SortFields.Clear     'sorting with resolved date
    ActiveWorkbook.Worksheets("Extract").Sort.SortFields.Add Key:=Range("E2:E2164" _
        ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Extract").Sort
        .SetRange Range("A1:AB2164")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With

    Range("A1").Select

    'filtering resolved tickets |received today|resolved on same day

    ActiveSheet.Range("$A$1:$X$164").AutoFilter Field:=5, Criteria1:="<>"
    ActiveSheet.Range("$A$1:$Z$2164").AutoFilter Field:=26, Criteria1:="Yes"
    ActiveSheet.Range("$A$1:$AB$2164").AutoFilter Field:=28, Criteria1:="Yes"

'    finding the yesterday last resolved ticket (on same day)

    Cells.Find(What:=yesterday_resolved_ticket__on_same_day, After:=ActiveCell, LookIn:=xlFormulas _
        , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate



'    selecting date of resolved tickets

    Call nextrow
 Selection.Offset(0, 1).Select
    Range(Selection, Selection.End(xlDown)).Select
    cticket_resolved_same_day = Application.CountA(Selection)  ' counting tickets resolved on same day
    Range(Selection, Selection.Offset(0, 1)).Select

' changing colour of the date
    With Selection.Font
        .ThemeColor = xlThemeColorAccent2
        .TintAndShade = 0
    End With

but after this sort and filter my excel sheet gets hung up the shet itself is not visible fully

can some one help me to find the problem in this code

4

0 回答 0