Dim sCellContent, sSrcStatus, sSrcName As String
Dim srcTable, tarTable As ListObject
Dim i, iSrcRowCount, iTarRowCount, iAnswer, iNewRow, iRowCount, iLoopCount, iLoopCounter As Integer
Dim bSlotFound, bStatusBarState As Boolean
Dim fractionDone As Double
iAnswer = MsgBox("You selected to update the funnel report. Are you sure ?", vbYesNo + vbQuestion, "Update")
If iAnswer = vbNo Then
Exit Sub
End If
'setup pointers to the tables
Set srcTable = Me.Application.ActiveWorkbook.Worksheets("Design Projects").ListObjects("SourceTable")
Set tarTable = Me.Application.ActiveWorkbook.Worksheets("Sheet2").ListObjects("tbFunnel")
'Get the row counts for source and target
iSrcRowCount = srcTable.ListRows.Count
iTarRowCount = tarTable.ListRows.Count
'Clear out the funnel table
If iTarRowCount > 0 Then
tarTable.DataBodyRange.Delete
End If
'Turn off screen updating ..
Application.ScreenUpdating = False
bStatusBarState = Application.DisplayStatusBar
Application.DisplayStatusBar = True
'sort before starting
srcTable.Sort.SortFields.Clear
srcTable.Sort.SortFields.Range("SourceTable").Select
srcTable.Application.Sort.SortFields.Add Key:=Range("SourceTable[Initiative Name]"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
应该添加排序字段的最后一个代码行失败,出现438运行时错误。我尝试将它改为各种直接即。 application.workbook(......无济于事。
我要做的就是在开始构建报告之前对srcTable表示的表进行预排序。
任何帮助都将受到高度赞赏..
由于