合并两个 Sub VBA 以便同时运行

合并两个 Sub VBA 以便同时运行

我如何让这两个 Subs 运行一次。我一直在尝试让 call sub 函数工作,但我知道我搞砸了

Sub DeleteSelectedColumns()
Dim currentColumn As Integer
Dim columnHeading As String
'
For currentColumn = ActiveSheet.UsedRange.Columns.Count To 1 Step -1
    columnHeading = ActiveSheet.UsedRange.Cells(6, currentColumn).Value
'Check whether to preserve the column
    Select Case columnHeading
    'Insert name of columns to preserve
        Case "DriverNo", "POD Name"
            'Do nothing
        Case Else
            'Delete the column
            ActiveSheet.Columns(currentColumn).Delete
        End Select
    Next
    '
  Call Sub sorthisfield
    End Sub
   '
Sub sortthisfield()
'
Sortthisfield Macro
'
ActiveWorkbook.Worksheets("Order Data").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Order Data").AutoFilter.Sort.SortFields.Add2 Key:= _
        Range("A6:A286"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
        :=xlSortNormal
    With ActiveWorkbook.Worksheets("Order Data").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub

相关内容