0
我想從數據透視表字段加載列表框中的行。我發現下面的代碼適用於ActiveX控件列表框,但不適用於用戶窗體列表框。 UserForm控件收到一個438錯誤。我正在處理一系列用戶表單,並且只能將ActiveX控件嵌入到工作表中。用戶自定義列表框填充數據透視表值 - excel
Private Sub ListBox1_Click()
Dim Pf As PivotField
Dim I As Integer
Set Pf = Worksheets("Sheet4").PivotTables(1).PivotFields("Field Name")
With ActiveSheet.ListBox1
.Clear
For I = 1 To Pf.PivotItems.Count
.AddItem Pf.PivotItems(I)
Next
End With
End Sub
原代碼發現這裏:http://www.pcreview.co.uk/forums/fill-listbox-values-pivot-table-field-example-t967653.html
在此先感謝您的幫助!在LinkedIn