Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default ListBox Question

Hello,
I have a list box on a user form that is populated with several sheet names.
If you don't select anything on the list, I want to send a message to the
user that he didn't select a sheet. I have one list box where the code
below works, one where it doesn't. I am using the listindex command to tell
what name has been selected. However, with the code below, the listindex is
0 when nothing was selected or 0 when the first item on the list is
selected. What could cause that?

If CHUpdate.ListThoseShts.ListIndex = -1 Then
MsgBox "You did not select a worksheet. Please try again."
GoTo 10
End If

Thanks,

Bill


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ListBox Question

Control toolbox toolbar listbox has listindex
-1 nothing selected
0 first item in list

A forms toolbar listbox has listindex
0 nothign selected
1 first item in list

Perhaps check the value of the list

if CHUpdate.ListThoseShts.Value = "" then



--
Regards,
Tom Ogilvy

"Bill" wrote in message
nk.net...
Hello,
I have a list box on a user form that is populated with several sheet
names. If you don't select anything on the list, I want to send a message
to the user that he didn't select a sheet. I have one list box where the
code below works, one where it doesn't. I am using the listindex command
to tell what name has been selected. However, with the code below, the
listindex is 0 when nothing was selected or 0 when the first item on the
list is selected. What could cause that?

If CHUpdate.ListThoseShts.ListIndex = -1 Then
MsgBox "You did not select a worksheet. Please try again."
GoTo 10
End If

Thanks,

Bill



Reply
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
Yet another Listbox question... Pixel Excel Programming 3 January 18th 06 10:52 PM
ListBox Question LearningExcel Excel Worksheet Functions 0 December 30th 05 05:46 PM
Listbox Question Greg B[_4_] Excel Programming 1 March 9th 05 02:17 PM
LIstbox Question Rich Cooper Excel Programming 1 June 2nd 04 03:50 PM
ListBox question jacqui[_2_] Excel Programming 1 February 12th 04 02:23 AM


All times are GMT +1. The time now is 12:57 AM.

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"