When recording macro my data is 4162 that why I have Range ("A1: A4162") each time I have data more than 4162 it will not work. I need code to pick any range of data I supply in the sheet
Range("A1").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("Incident Ticket").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Incident Ticket").AutoFilter.Sort.SortFields.Add _
Key:=Range("A1:A4162"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Incident Ticket").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With