Sub tryn()
' tryn Macro
Application.ScreenUpdating = False
Application.DisplayAlerts = False
ActiveWindow.FreezePanes = False
Range("A2").Select
ActiveWindow.FreezePanes = True '<--Freeze row 1
Columns(15).EntireColumn.Delete Shift:=xlToLeft '<-- Write the letter of the column you want to delete
Columns(13).EntireColumn.Delete Shift:=xlToLeft '<-- Write the letter of the column you want to delete
Columns(9).EntireColumn.Delete Shift:=xlToLeft '<-- Write the letter of the column you want to delete
'Sheets(1).Delete
lr = Cells(Rows.Count, "I").End(xlUp).Row
'delete lines
For i = lr To 2 Step -1
If Cells(i, "F").Value < 1 Then
Rows(i).Delete
End If
Next
lr = Cells(Rows.Count, "I").End(xlUp).Row
With Range("F2:F" & lr).Font
.Bold = True
.Color = -16776961
.TintAndShade = 0
.Name = "Arial"
.Size = 10
End With
Columns("F:F").HorizontalAlignment = xlCenter
Cells(lr + 1, 8).Value = "TOTAL"
Cells(lr + 1, 8).HorizontalAlignment = xlCenter
Cells(lr + 1, 9).Value = WorksheetFunction.Sum(Range(Cells(2, 9), Cells(lr, 9)))
Cells(lr + 1, 9).NumberFormat = "#,##0.00"
With Range(Cells(lr + 1, 8), Cells(lr + 1, 9)).Font
.Bold = True
.Color = -16776961
.TintAndShade = 0
.Name = "Arial"
.Size = 10
End With
With Cells(1, "M")
.Value = "COMMENTS"
.Font.Bold = True
.Font.Name = "Arial"
.Font.Size = 10
End With
Cells.EntireColumn.AutoFit '<-- AUTOFIT all columns
MsgBox "End"
End Sub