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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
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,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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