The following statements, as part of a VBA sort routine, work as intended.
With ActiveWorkbook.Worksheets(Sh).Sort
.SetRange Range1
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
I use the routine repeatedly in a single Sub to sort on both rows and columns depending on what sheet I am sorting. I would like to replace "xlTopToBottom" with a variable, so that, where appropriate, I can set the orientation variable to 1 or to "xlLeftToRight". This doesn't seem to work. Can it be done?
Thanks.