Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
A code snippet:
Function FillYearMonth(ByVal theWorkbook As String, ByVal theWorkSheet As String, _ ByVal thePivotTable As String, ByVal thePageField As String) Dim ws As Worksheet Set ws = Worksheets(theWorkSheet) Dim pt As PivotTable Set pt = ws.PivotTables(thePivotTable) Dim pf As PivotField Set pf = pt.PivotFields(thePageField) Dim lb As ListBox Set lb = Worksheets(theWorkSheet).lstYearMonth Call FillListBox(pf, lb) End Function I keep getting error 13 after executing the line Set lb = Worksheets(theWorkSheet).lstYearMonth I checked and there really is a ListBox called lstYearMonth on the worksheet (on ever worksheet there is a ListBox named lstYearMonth) Can anyone point me what is wrong in this code? -- Amedee |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dim lb As MSForms.ListBox
Set lb = ws.lstYearMonth An unmodified Listbox is a Forms toolbar listbox while yours seems to be from the Control Toolbox. -- Jim "Amedee Van Gasse" wrote in message ... |A code snippet: | | Function FillYearMonth(ByVal theWorkbook As String, ByVal theWorkSheet | As String, _ | ByVal thePivotTable As String, ByVal thePageField As String) | Dim ws As Worksheet | Set ws = Worksheets(theWorkSheet) | Dim pt As PivotTable | Set pt = ws.PivotTables(thePivotTable) | Dim pf As PivotField | Set pf = pt.PivotFields(thePageField) | Dim lb As ListBox | Set lb = Worksheets(theWorkSheet).lstYearMonth | Call FillListBox(pf, lb) | End Function | | I keep getting error 13 after executing the line | Set lb = Worksheets(theWorkSheet).lstYearMonth | | I checked and there really is a ListBox called lstYearMonth on the | worksheet (on ever worksheet there is a ListBox named lstYearMonth) | | | Can anyone point me what is wrong in this code? | | | -- | Amedee |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Setting Listbox Size VBA | Excel Worksheet Functions | |||
Setting and filter Listbox data | Excel Discussion (Misc queries) | |||
Setting up a validation of data listbox to provide the unique items within a range | Excel Worksheet Functions | |||
ListBox, error 424 | Excel Worksheet Functions | |||
Help! Activate worksheet from a listbox | Excel Worksheet Functions |