Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Error (empty list box)?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ctech - 22 Mar 2006 15:04 GMT
Hi,

See VBA macro below:

The macro is to find the number of marked entities in the list bo
"cboSecondary" which can be found on the worksheet "combo".

However there are something wrong with the macro... but I don't kno
what..  Tryied for about 2 days now...  see error attached.

Thanks

> Sub Update_task_part2()
> ' This macro adds the tasks picked in the List Box and adds them t
> the
> ' Tasks revenue part of the form
> ' Created by Christian Simonsen 21/03/06
>
> Dim mRows As Long
> Dim i As Long
> Dim Msg As String
>
> ' hides/unhides the required rows depending on the number of tasks
> ' picked
> mRows = 0
> With combo.Shapes(cboSecondary)
> For i = 0 To .ListCount - 1
> If .Selected(i) Then mRows = mRows + 1
> Next
> End With
> Range("list_rev").EntireRow.Hidden = False
> mRows = 10 - mRows + 1
> Range("list_rev").Rows("" & _
> mRows & ":10").EntireRow.Hidden = True
>
> ' Gets the task numbers for the rows
> With combo.Shapes(cboSecondary)
> For i = 0 To .ListCount - 1
> If .Selected(i) Then
> Msg = Msg & .List(i) & vbCrLf
> End If
> Next i
> End With
>
> If Len(Msg) = 0 Then
> Msg = "No items selected"
> Else
> MsgBox Msg
> End If
>
> End Su

+-------------------------------------------------------------------
|Filename: error.jpg                                                
|Download: http://www.excelforum.com/attachment.php?postid=4503     
+-------------------------------------------------------------------

--
Ctec
paul.robinson@it-tallaght.ie - 22 Mar 2006 15:17 GMT
Hi
Try Worksheets("combo") - which is an object, instead of combo.

regards
Paul
Ctech - 22 Mar 2006 15:34 GMT
That did not help, as the name of the Worksheet is actually "Template"
but I have given it the nickname "combo"....

Anyway... Im getting the message that the shape is empty... ( i think

--
Ctec
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.