Results 1 to 5 of 5

Validate Listbox Entry

Threaded View

  1. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Validate Listbox Entry

    Hello AndyE,

    When a ListBox is updated through code, no events are triggered. An object must have the focus for events to fire. You need to make the label visible when you check for the item selected by the user in ListBox1.

    Here is the updated code for the UserForm.
    Option Explicit
    
    Private Sub userform_initialize()
    
        Label1.Visible = False
        
    End Sub
    
    Private Sub commandbutton1_click()
    
        Dim iCtr As Long
    
        For iCtr = 0 To Me.ListBox1.ListCount - 1
            If Me.ListBox1.Selected(iCtr) = True Then
                Me.ListBox2.AddItem _
                Me.ListBox1.List(iCtr)
                Label1.Visible = True
            End If
        Next iCtr
    
    End Sub
    Last edited by Leith Ross; 03-08-2015 at 04:24 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Validate that entry in one cell matches an entry in another range of cells
    By Grilleman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2014, 03:57 PM
  2. [SOLVED] VBA to validate entry?
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-25-2014, 11:46 AM
  3. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  4. [SOLVED] MsgBox to validate an entry
    By TimN in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-21-2006, 04:15 PM
  5. Validate Combobox entry
    By MBlake in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-04-2005, 04:06 PM

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