05-08-19 06:41 AM
05-08-19 08:31 AM
Sub ExcelFormatting() 'Autofit columns Columns("A:G").AutoFit 'Format header Bold and background color Range("A1:G1").Cells.Font.Bold = True Range("A1:G1").Cells.Interior.Color = &HC0FFFF 'To format entire row use: Rows("1").Cells.Font.Bold = True 'Autofilter If FilterMode = False Then 'Turn on AutoFilter Range("A1:G1").AutoFilter Else 'Reset AutoFilter ActiveWorkSheet.ShowAllData Range("A1:G1").AutoFilter End If 'Borders Range("A1:" & Cells.SpecialCells(xlCellTypeLastCell).Address).Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous End With Range("A1").Select End Sub