LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error (empty list box)?


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

-----------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...fo&userid=2774
View this thread: http://www.excelforum.com/showthread.php?threadid=52525

 
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
#VALUE error with empty cells adriver Excel Discussion (Misc queries) 1 October 9th 09 10:16 PM
#Empty error Alan P Excel Discussion (Misc queries) 2 October 5th 06 02:37 PM
Remove empty cells from named list / validation list Sp00k Excel Worksheet Functions 4 April 28th 06 03:45 PM
error: cannot empty the Clipboard Jane New Users to Excel 0 December 29th 05 07:59 PM


All times are GMT +1. The time now is 09:45 PM.

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

About Us

"It's about Microsoft Excel"