Results 1 to 4 of 4

Double Click Listbox question

Threaded View

  1. #1
    Registered User
    Join Date
    02-13-2015
    Location
    Brisbane, Australia
    MS-Off Ver
    2016
    Posts
    34

    Double Click Listbox question

    Hi everybody,

    Was wondering if anybody could help with the following code. Firstly, yes, I am very new to vb coding!

    I have a listbox with an OK and Cancel button. I wanted the user to be able to double click their choice, as well as single click and then OK.

    I'm not sure where to put the code. Any help would be appreciated.

    Here is the code:




    Private Sub Cancel_Click()
        Unload Me
    End Sub
    
    Private Sub OK_Click()
        Range("D65536").End(xlUp).Offset(1, 0).Value = List1
        Unload Me
    End Sub
    
    Private Sub UserForm_Click()
        
    End Sub
    
     
    Private Sub Incident_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
        Range("D65536").End(xlUp).Offset(1, 0).Value = List1
        Unload Me
    End Sub
     
    Private Sub UserForm_Initialize()
        With Incident
            List1.AddItem "Congestion"
            List1.AddItem "Extreme / Adverse Natural Event"
            List1.AddItem "Air Quality"
            List1.AddItem "Civil Unrest"
            List1.AddItem "Motor Vehicle Crash"
            List1.AddItem "Animal on Tollroad"
            List1.AddItem "Illegal / Dangerous Driving Manoeuvres"
            List1.AddItem "TCC Incident - Fire / Fire Alarm"
            List1.AddItem "Prohibited Vehicle"
            List1.AddItem "Overheight Vehicle"
            List1.AddItem "Person on Tollroad"
            List1.AddItem "Bomb Threat / Suspicious Package"
            List1.AddItem "Spill / Debris"
            List1.AddItem "Stationary Vehicle"
            List1.AddItem "System Failure / Degradation"
            List1.AddItem "Vehicle Fire"
            List1.AddItem "Water Inundation"
            List1.AddItem "Plant Fire / Fire Alarm"
            List1.AddItem "Tunnel Evacuation"
            List1.AddItem "Other / Miscellaneous"
        
        End With
            
        Exit Sub
        
    End Sub
    Thx in advance!
    Last edited by frostii; 02-17-2015 at 07:37 PM. Reason: Updating as per forum rules

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] ListBox Double Click () selection from another worksheet and populate data in text box
    By imzhakmaya in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2014, 03:49 AM
  2. Double click Listbox to edit item
    By johan12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2012, 04:12 AM
  3. Replies: 3
    Last Post: 08-10-2011, 02:02 PM
  4. double click option in listbox outputs to cell in excel 97 !
    By spyrule in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2006, 12:05 AM
  5. Need selected item from listbox after double click
    By peterfarge@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 11:20 AM

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