Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default error 13 when setting worksheet listbox

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,718
Default error 13 when setting worksheet listbox

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Listbox Size VBA Sandy Excel Worksheet Functions 1 April 27th 07 05:48 PM
Setting and filter Listbox data Gizmo63 Excel Discussion (Misc queries) 1 February 5th 07 04:03 PM
Setting up a validation of data listbox to provide the unique items within a range [email protected] Excel Worksheet Functions 8 July 30th 06 09:00 AM
ListBox, error 424 coldmejl Excel Worksheet Functions 1 June 14th 05 10:15 AM
Help! Activate worksheet from a listbox Bob Phillips Excel Worksheet Functions 0 May 18th 05 09:09 AM


All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"