|
|
|
|
|
|
a***m 发帖数: 666 | 1 不知道发在哪里好,就发这里了。这里能人多,能不能帮我一个忙。我正在学excel
VBA,今天遇到一个pivot table问题。The routine is to filter the page field
for the dates before 30 Nov 2013. But it doesn't work. The system pops up an
error message: object or application defined error. 可是我找死都找不到问题
在哪里。也许你们看到那个inputbox function 很奇怪。本来我想通过它输入一个日期
,然后pivot table根据输入的日期自动filter the pivot table。但是有问题。我就
用30/11/2013来测试。可惜还是没反应。愁呀,求大牛帮忙,不胜感激。
Sub Update()
Application.Calculation = xlCalculationManual
Worksheets("pivot").Select
ActiveSheet.PivotTables("PivotTable8").PivotFields("Sof Details - End
Date (Trans)").ClearAllFilters
ActiveSheet.PivotTables("PivotTable8").RefreshTable
With ActiveSheet.PivotTables("PivotTable8").PivotFields("SOF")
.PivotItems("(blank)").Visible = False
End With
With ActiveSheet.PivotTables("PivotTable8").PivotFields( _
"Sof Details - End Date (Trans)")
.PivotItems("(blank)").Visible = False
End With
Dim EndDate As String
EndDate = InputBox("Enter the month end date in dd/m/yyy: ")
Worksheets("pivot").Select
ActiveSheet.PivotTables("PivotTable8").PivotFields( _
"Sof Details - End Date (Trans)").PivotFilters.Add Type:=
xlBeforeOrEqualTo, _
Value1:="30/11/2013"
End Sub | a***m 发帖数: 666 | | a***m 发帖数: 666 | |
|
|
|
|
|