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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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