Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sat, 22 Mar 2008 06:38:27 -0400, "Cheryl & Mike Arsenault"
wrote: Please have a look at the 2 subs below Private Sub POLines_Change() UpdateTransferButton POLines, AddPSLines End Sub Private Sub UpdateTransferButton(ByRef lb As ListBox, ByRef b As CommandButton) Dim index As Integer For index = 0 To lb.ListCount - 1 If lb.Selected(index) Then b.Enabled = True Exit Sub End If Next b.Enabled = False End Sub From the first subroutine, I'm trying to call the second one, which takes as parameters a ListBox and a CommandButton. I'm getting a runtime error on the call form the first subroutine indicating that I have type mismatch. Can someone tell me why?? When I change the 2 parameters to Variants, everything is OK. Why can't I pass a ListBox as a ListBox and same with a CommandButton In addition to the other responses, sometimes there's a conflict between classes with the same names. Try calling out those arguments as MSForms.ListBox MSForms.CommandButton and see if that takes care of it. -- Dick Kusleika Microsoft MVP-Excel http://www.dailydoseofexcel.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pass listbox values to autofilter | Excel Programming | |||
Pass a form Listbox as an object | Excel Programming | |||
How do I pass an array to a listbox? | Excel Programming | |||
How to pass ListBox into a Sub? | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming |