0
嘿傢伙我繼續得到運行時錯誤1004對象'_Global'的方法'範圍'失敗,當我嘗試做這個簡單的排序。運行時錯誤'1004'排序
Sub Assy_Weld_TrumpfSort()
'
' Assy_Weld_TrumpfSort
'
Dim sh As Worksheet
Dim TableName As String
Dim theTable As ListObject
Set sh = ActiveSheet
TableName = sh.Name
Set theTable = ActiveWorkbook.Worksheets(TableName).ListObjects(TableName)
theTable.sort.SortFields.Clear
theTable.sort.SortFields.Add _
Key:=Range(TableName & "[PART NUMBER]"), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal
With theTable.sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub