I am very new to macros. I recorded a macro on a spreadsheet and tried to generalize it to accommodate various number of rows in the data. I am now getting a Run Time error of 1004 that says
Method of 'Range' of object' _global' failed.

The line of code that is in yellow is:
ActiveSheet.Sort.SortFields.Add Key:=Range("Won or Lost Quote"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal


The full code I have is:

Cells.Select
ActiveSheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("Won or Lost Quote"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveSheet.Sort.SortFields.Add Key:=Range("Quote Requested By"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("myData")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Cells.Select
Selection.Subtotal GroupBy:=13, Function:=xlSum, TotalList:=Array(16), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End Sub