Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
This code meant to sort a range of cells is failing with an "The sort reference is not valid. Make the sure that it's within the data you want to sort anbd the first Sort By box is isn't the same or blank." error with the line in red.
Rich (BB code):
With ws_thold
If Application.WorksheetFunction.CountA(ws_thold.Range("AJ1:AJ8")) > 1 Then
Set rng_trnservices = ws_thold.Range("AJ1:AQ8")
With rng_trnservices
.Sort key1:=.Range("AQ1"), order1:=xlAscending, Header:=xlNo
End With
ActiveWorkbook.Names.Add Name:="TrnServices", RefersTo:=rng_trnservices
End If
End With