I have checked all of the forums questions that relate to this topic. I am unable to get my code to work.
Here is the code. Please let me know what I need to correct.
Dim strDataRange As String
Dim strKeyRange As String
strDataRange = "B" & strStartRow & ":M" & strLastRow
strKeyRange = "B" & strStartRow & ":B" & strLastRow
Range(strDataRange).Sort Key1:=strKeyRange, Order1:=xlDescending, Header:=xlNo
The strDataRange is B5:M18.
The strKeyRange is B5:B18.