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: 24
Default how to find out when a ListBox is populated or select it

Dear experts,
I am working on a userform.
I am inputting data from different text boxes into a
ListBox via clicking a button, and then transfering the
combined data from this ListBox into a macro via clicking
a second button.
I want the userform to tell the user that he needs to
input some data if none was entered, so I wrote this code:

If ListBox4.ListIndex = -1 Then
MsgBox "Please enter the product data before clicking on
this button"
Exit Sub
End If

The problem I have is that as at the end none of the items
in ListBox4 is selected (items are just added via clicking
the button), even if the ListBox is populated the
ListIndex returns -1.
Is there a way I can select the ListBox, or get around
this problem?

Many thanks in advance for your help!
Kind regards,
Valeria
 
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
find last populated cell in range of cells Maximus[_2_] Excel Worksheet Functions 6 July 22nd 09 04:31 PM
Find the first or last populated column in a range Commish Excel Worksheet Functions 6 May 14th 09 10:16 PM
I need to select some values in a Listbox???? Angel[_3_] Excel Programming 0 January 22nd 04 02:26 PM
excel - ListBox multiple Select sjvenz Excel Programming 4 December 9th 03 08:52 AM
Select from table and listbox PawelR Excel Programming 1 November 7th 03 01:21 PM


All times are GMT +1. The time now is 04:05 PM.

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"