I swear this was working the other day but now for the life of me I cannot figure out what is wrong. Below is a snippet of my data set and the code I am trying to use.
VBA Code:
Private Sub CommandButton2_Click()
'Sorts Raw Data Button
'Sorts Raw Data on Equipment, Year and Period
With ActiveSheet.Sort
'Clears sorting
.SortFields.Clear
.SortFields.Add Key = ("D7"), Order:=xlAscending
.SortFields.Add Key = ("A7"), Order:=xlAscending
.SortFields.Add Key = ("B7"), Order:=xlAscending
lr = Cells.Find("*", Cells(1, 1), xlFormulas, xlPart, xlByRows, xlPrevious, False).Row
.SetRange Range("A7:L" & lr)
.Header = xlNo
.Apply
End With
End Sub