I have a fairly simple macro built that is supposed to delete row 2, bold format font in row 1, auto fit column widths, and sort by column. The number of rows in the worksheet will vary, but the number of columns are the same every time. I've done a lot of searching in forums for the 1004 error, but nothing I try seems to work. Here is my code:
Thanks in advance!
Code:
Rows("2:2").Delete Shift:=xlUp
Rows("1:1").Font.Bold = True
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Columns("D:D").EntireColumn.AutoFit
With ActiveSheet.Sort
.SortFields.Add Key:=ActiveSheet.Range("A1"), Order:=xlAscending
.SortFields.Add Key:=ActiveSheet.Range("B1"), Order:=xlAscending
.SortFields.Add Key:=ActiveSheet.Range("C1"), Order:=xlAscending
.SortFields.Add Key:=ActiveSheet.Range("F1"), Order:=xlAscending
.SetRange Range("A1").CurrentRegion
.Header = xlYes
.Apply
End With
Thanks in advance!