‘1004’: “The sort reference is not valid.”

I suspect you need to fully qualify the Key1 range, because you are calling the code from a different sheet:

Worksheets("EmployeeData").Range("K3:K" & EmpBRange).Sort Key1:=Worksheets("EmployeeData").Range("K3:K" & EmpBRange)

This is generally a good idea.

Leave a Comment