Sub Zflex_For_Customer2222()
Dim LastRow As Long
Dim bottom As Long
Application.ScreenUpdating = False
LastRow = Range("B65536").End(xlUp).Row
bottom = Range("f65536").End(xlUp).Row
Range("E6:Q" & bottom).Sort Key1:=Range("F6"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal
Range("D6").FormulaR1C1 = "=RC[2]"
Range("D7").FormulaR1C1 = "=IF(RC[2]=R[-1]C[2],"""",RC[2])"
Range("D7").AutoFill Destination:=Range("D7:D" & LastRow), Type:=xlFillDefault
Range("F4").Copy _
    Destination:=Range("D4")
Columns("F:F").EntireColumn.Hidden = True
Range("R6").FormulaR1C1 = "=IF(RC[-2]="""",IF(RC[-1]="""",1,0),0)"
Range("R6").AutoFill Destination:=Range("R6:R" & LastRow), Type:=xlFillDefault
With ActiveWindow
    .DisplayGridlines = False
    .DisplayZeros = False
End With
With Range("D6:R6")
    .FormatConditions.Delete
    .FormatConditions.Add Type:=xlExpression, Formula1:="=$O6=0"
    With .FormatConditions(1).Font
        .Bold = True
        .Italic = False
    End With
    .FormatConditions(1).Interior.ColorIndex = 4
    .FormatConditions.Add Type:=xlExpression, Formula1:="=$R6=1"
    With .FormatConditions(2).Font
        .Bold = True
        .Italic = False
        .ColorIndex = 6
    End With
    .FormatConditions(2).Interior.ColorIndex = 3
    .AutoFill Destination:=Range("D6:R" & LastRow), Type:=xlFillFormats
End With
With Range("D6:Q" & LastRow)
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    With .Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
End With
With Range("D4:Q4")
    With .Font
        .Name = "Arial"
        .FontStyle = "Bold"
        .Size = 12
        .ColorIndex = 6
    End With
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    With .Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With .Interior
        .ColorIndex = 3
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
    End With
End With
Columns("R:R").EntireColumn.Hidden = True
Columns("A:Q").EntireColumn.AutoFit
Columns("B:C").EntireColumn.Hidden = True
Range("F4").Copy _
    Destination:=Range("D4")
Columns("F:F").EntireColumn.Hidden = True
With Range("I2")
    .FormulaR1C1 = "=NOW()"
    With .Font
        .ColorIndex = 5
        .Bold = True
        .Name = "Arial"
        .Size = 18
        .ColorIndex = 5
    End With
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub