I have a workbook with several sheets, two of which are similar. I have automated a Sort with the following function, called from the Before_save event of the workbook and it works. However, I set it up as a temporary measure until I worked out how to incorporate the range names into the code and this I can’t get to work. The range is dynamic so grows with input and could currently end on F250 for example. I have this worked properly it just doesn’t seem to transfer to code. I would have thought I could replace “A6:F1000” with a string expression for the Name but I can’t.
Any advice out there?
Function Reorder(ByVal strSheet As String)
Worksheets(strSheet).Range(“a6:f1000”).Sort _
key1:=Worksheets(strRange).Range(“A6”)
End Function
Thanks
Peter