Event Tied to Data Entry or ClearContents

tlee

Board Regular
Joined
Feb 12, 2003
Messages
118
I could sure use some help on sorting this one out.

I have a sheet on which I would like to cause a YesNo MsgBox to open whenever an entry (or deletion) is made in the following range:

Range("E10:E19,L10,L19")

All I've been able to get to work so far is when an entry is made in ("E10:E19"), but I'm not sure how to include the other column in the range, or how to get it to react to a "ClearContents" in any part of the range.

Can someone provide me some direction? Here's the code I've developed so far:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
     
    If Target.Column <> 5 Then Exit Sub
    Dim YesNo As Integer
    YesNo = MsgBox("Would you like to include these initials in the selection list on the ::Patient Visits"" sheet?", 36, "INCLUDE INITIALS ON LIST?")

    Select Case YesNo

        Case vbYes
                Application.EnableEvents = False
                Application.Run "sort_stuff"
                Application.EnableEvents = True

        Case vbNo
            Exit Sub

    End Select

End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
hi!
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Excel.Range) 
 
 
Set isect = Application.Intersect(Range("e10:e19,l10:l19"),target)
If isect Is Nothing Then exit sub
 
    Dim YesNo As Integer 
    YesNo = MsgBox("Would you like to include these initials in the selection list on the ::Patient Visits"" sheet?", 36, "INCLUDE INITIALS ON LIST?") 

    Select Case YesNo 

        Case vbYes 
                Application.EnableEvents = False 
                Application.Run "sort_stuff" 
                Application.EnableEvents = True 

        Case vbNo 
            Exit Sub 

    End Select 

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

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