Change and Doubleclick events for the same UserForm ListBox

Sal Paradise

Well-known Member
Joined
Oct 23, 2006
Messages
2,457
I have a UserForm Listbox Called 'PressLossList'. I have a change event for it that works just dandy (wrapped in Sub PressLossList_Change() tags). I also want to have a different event for if it's double-clicked. For that I use this code:
Code:
Private Sub PressLossList_DoubleClick()
    
    Dim c           As Range
    Dim TitleName   As String
    
    TitleName = Me.PressLossList.Value
    
    With Worksheets("Opportunities").Range("$C:$C")
        Set c = .Find(TitleName, , xlValues)
        If Not c Is Nothing Then
            Worksheets("Opportunities").Cells(c.Row, 1).EntireRow.Delete
        End If
    End With

End Sub

Any ideas?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Choose your events from the dropdown list. The syntax is:
Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    MsgBox "DblClick"
End Sub
 
Upvote 0
Ah, I didn't even see the dropdown list until you pointed it out. My apologies for a stupid question with an easy answer. Thank you for the help.
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,795
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top