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


I am pretty new to this forum and have had most of my questions answere
by searching other threads. But can't find an answer on this one.

I have created a form for data entry and it has several list and tex
boxes. I have used an if then statement to validate that the tex
boxes have data in them at the time of execution. I would like to d
the same with the list box but the code does not work. The list box i
poplulated but no data is selected. When I press "OK" I would like fo
it to validate that data is selected / highlighted.

Private Sub cmdOK_Click()
If lboTeam.value = "" Then
MsgBox "You need to fill in your Team Name"
Exit Sub
End If

If txtPlayer.Value = "" Then
MsgBox "You need to fill in the Player's Name"
Exit Sub
End If

Any help would be greatly appreciated. Thanks

--
kuznia
-----------------------------------------------------------------------
kuzniaj's Profile: http://www.excelforum.com/member.php...fo&userid=3471
View this thread: http://www.excelforum.com/showthread.php?threadid=54479

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Listbox data required

Private Sub cmdOK_Click()
If lboTeam.ListIndex = -1 Then
MsgBox "You need to Select your Team Name"
Exit Sub
End If

--
Regards,
Tom Ogilvy


"kuzniaj" wrote:


I am pretty new to this forum and have had most of my questions answered
by searching other threads. But can't find an answer on this one.

I have created a form for data entry and it has several list and text
boxes. I have used an if then statement to validate that the text
boxes have data in them at the time of execution. I would like to do
the same with the list box but the code does not work. The list box is
poplulated but no data is selected. When I press "OK" I would like for
it to validate that data is selected / highlighted.

Private Sub cmdOK_Click()
If lboTeam.value = "" Then
MsgBox "You need to fill in your Team Name"
Exit Sub
End If

If txtPlayer.Value = "" Then
MsgBox "You need to fill in the Player's Name"
Exit Sub
End If

Any help would be greatly appreciated. Thanks.


--
kuzniaj
------------------------------------------------------------------------
kuzniaj's Profile: http://www.excelforum.com/member.php...o&userid=34712
View this thread: http://www.excelforum.com/showthread...hreadid=544796


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Listbox data required


Works great thankx for the quick response.


--
kuzniaj
------------------------------------------------------------------------
kuzniaj's Profile: http://www.excelforum.com/member.php...o&userid=34712
View this thread: http://www.excelforum.com/showthread...hreadid=544796

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
Required data entry SixBowls Excel Discussion (Misc queries) 6 November 4th 09 02:23 PM
Help required with Consolidating Data JosephJohnSmith Excel Worksheet Functions 1 October 8th 05 01:56 AM
Removing lines of data that do not contain required data (macro) Sean[_7_] Excel Programming 1 May 21st 04 03:53 PM
SQL data access help required? Mark[_32_] Excel Programming 0 January 8th 04 04:59 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM


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