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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,701
Messages
5,855,239
Members
431,716
Latest member
Ibyb

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
Top