不知何故,我没有得到排序键的东西。我浏览了网上的一些例子。它们看起来很清楚,但我不明白您如何准确地将键分配给某个列...我的代码应该从 A2:S 中全部排序。第一个条件是 F 列,然后按 G 列排序。示例:
F2: A G2:B
F3: A G3:C
F4: A G4:A
应该变成:
F2: A G2:A
F3: A G3:B
F4: A G4:C
到目前为止我得到的代码:
Private Sub ButtonExport_Click()
Dim sKey1 As String
Dim sKey2 As String
Dim sKey3 As String
sKey1 = Worksheets("Variable Tags").Range("lblSortByKey1").Value
sKey2 = Worksheets("Variable Tags").Range("lblSortByKey2").Value
If sKey2 = "" Then
Call SortTable(sKey1, , , "tblTagLists_All")
MsgBox "Sorting done based on one column"
Else
Call SortTable(sKey1, sKey2, , "tblTagLists_All")
MsgBox "Sorting done based on two columns"
End If
End Sub