G
Guest
Excel 2003. I am trying to programmatically sort a worksheet. I used the
Macro recorder to do it and copied the code. My workbook is open and the
worsheet is open (ShNew). Yet, the following gives me an error:
ShNew.Range("A2:F" + Trim(Str(I))).Select
Selection.Sort Key1:=Range("D1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
What am I doing wrong? Or better yet, simply, "How do I perform the sort on
ShNew?"
Macro recorder to do it and copied the code. My workbook is open and the
worsheet is open (ShNew). Yet, the following gives me an error:
ShNew.Range("A2:F" + Trim(Str(I))).Select
Selection.Sort Key1:=Range("D1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
What am I doing wrong? Or better yet, simply, "How do I perform the sort on
ShNew?"