0
我想使用另一列(位於另一個工作表中)中的值對工作表中的列進行排序。使用Excel VBA按自定義列表對工作表數據排序
例如,值在列中「ABC」,「DEF」和「GHI」。這些值位於第一個工作表的一列中,但該列的值已混亂。我希望它們按照「abc」,「def」和「ghi」的順序進行排序。
我嘗試這樣做,例如:
Sheets("Sheet1").Columns("G").Sort key1:=Sheets("Sheet2").Range("D:D"), order1:=xlAscending, Header:=xlYes.
有一個錯誤,當我這樣做:
The sort reference is not valid. Make sure that it's within the data you want to sort, and the first Sort By box isn't the same or blank.
不知道有什麼錯誤。需要一些幫助。