Hello! I think I might be doing something dumb because my code isn't that complicated, but...I keep getting a run-time error on the following bit:
I've searched online and a bunch of the advice for this error goes right over my head. Any help would be greatly appreciated. Thank you!
Code:
With WB1.Sheets(1)
'Count number of rows:
x = .Range("A1048576").End(xlUp).Row
'Find Test Name column:
TestCol = .Rows(5).Find(What:="Test.Name", LookAt:=xlPart, SearchOrder:=xlByColumns).Column
'Sort:
With .Sort
.SortFields.Clear
.SortFields.Add Key:=.Range(.Cells(6, TestCol), .Cells(x, TestCol)), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal **** Error occurs here! ****
.SetRange .Range(.Cells(5, 1), .Cells(x, .Range("XFD5").End(xlToLeft).Column))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
I've searched online and a bunch of the advice for this error goes right over my head. Any help would be greatly appreciated. Thank you!