Clear Contents on Worksheet Change Event with Merged cells

programsam

Board Regular
Joined
Feb 10, 2016
Messages
123
Greetings gang,

Trying to clear contents in the corresponding cell in columns B - E when a change is made on the same row in column A. Making the change using the code below does not trigger a change. Additionally, columns B, C and D are merged so I'm not sure if that's what's causing the issue.

Any assistance you guys can provide is much appreciated.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rLook As Range, r As Range, Intr As Range
    
    Set rLook = Range("A7:A11")
    Set Intr = Intersect(rLook, Target)
    
    If Intr Is Nothing Then Exit Sub
    Application.EnableEvents = False
        For Each r In Intr
            If r.Value <> "" Then
                rw = r.Row
                Range("B" & rw & ":E" & rw).ClearContents
            End If
        Next r
    Application.EnableEvents = True
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
The code works fine for me, are you sure it's actually being executed?
 
Upvote 0
The code works fine for me, are you sure it's actually being executed?

Well, I closed the file and reopened and all is good in the land.

Been working on this ****ed thing for 2 hours to no avail. Thanks for restoring my sanity!
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,827
Members
449,470
Latest member
Subhash Chand

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