+ Reply to Thread
Results 1 to 5 of 5

help with error execute

  1. #1
    Registered User
    Join Date
    07-30-2009
    Location
    melbourne, AUS
    MS-Off Ver
    Excel 2003
    Posts
    33

    help with error execute

    howdy,

    can anyone tell me how to fix this small issue i have with the following code?
    i want the error execute to run if a row of the listbox is not highlighted (clicked On) at the moment it will erase the first row of listbox if proceded
    with.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: help with error execute

    Hello.

    If i understand you correclty you want to show the msgbox if the user has not selected an item from the listbox. To do this use the .ListIndex of the listbox. If the user has not selected an item the .ListIndex will be -1, 0(zero) will be the 1st item in the list.

    hope this helps.


  3. #3
    Registered User
    Join Date
    07-30-2009
    Location
    melbourne, AUS
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: help with error execute

    solved

    the mistake was, if your interested,

    if listbox1.value = "" then

    it should be

    if listbox1.text = "" then

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: help with error execute

    Glad you got it.

    I tryed to clean the code a little for you.
    Please Login or Register  to view this content.
    cheers

    Edit. The diffrence between .text and .value is when the listbox is in a unselected state .value = Null as where .text = ""
    Last edited by D_Rennie; 11-30-2009 at 12:03 AM.

  5. #5
    Registered User
    Join Date
    07-30-2009
    Location
    melbourne, AUS
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: help with error execute

    Thanks for your help D_Rennie

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1