LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default ListBox error "Invalid argument"

I get the above error in my code on line Me.ListBox2.Remove Item i. What I am
attempting to do is remove any item from the ListBox2 in excess of 25 Item.
In other words, if the user attempts to place 26 or more items in the ListBox
a message is display and the excess items are removed.
This is my dilemma. Any help will be greatly appreciated.

For i = 0 To ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) = True And i <= 25 Then
Me.ListBox2.AddItem ListBox1.List(i)
ElseIf ListBox1.Selected(i) = True And i 25 Then
MsgBox Msg, Style, Title
Me.ListBox2.RemoveItem i
Exit For
End If
Next i
 
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
"Compile Error: ByRef argument type mismatch" when calling my function from another module ker_01 Excel Programming 2 August 14th 08 03:53 PM
Export to excel via webpage: "Invalid Procedure Call or Argument" Bruno Excel Programming 0 March 19th 08 11:55 AM
Pivot Table Creation Macro fails with Error #5 "Invalid procedure call or argument" [email protected] Excel Programming 1 July 10th 07 08:01 PM
"ByRef argument type mismatch" Error Baapi[_4_] Excel Programming 2 September 17th 05 12:47 AM
Invalid "format string" argument in Format fuction jjk Excel Programming 3 June 14th 05 09:19 PM


All times are GMT +1. The time now is 03:50 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"