Delete cells in current row when deleting cell contents in column

CMcColm

New Member
Joined
Aug 20, 2016
Messages
9
I've been trying to do this for a couple of days and I've made some headway but I'm struggling with it. I have made the macro I want but it's the activation I am struggling with.

Range("B" & ActiveCell.Row & ":I" & ActiveCell.Row).ClearContents

That is what I want to activate but I only want to activate it if someone deletes the contents of "J".

It's basically for tracking. "J" must have initials in it before other cells in the row can be modified. I want the whole row to clear if someone puts in their initials, fills in the rest of the row, then deletes their initials.

Thanks!
 
I've tried to insert Exit Sub somewhere appropriate but nowhere seems to work.

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Application.EnableEvents = False

    If Target.Cells.Count > 1 Then
            MsgBox "Change only one cell at a time"
            Application.Undo
            Exit Sub
            
        If Not Intersect(Target, Range("A:A")) Is Nothing And Target.Value = "" Then
            Target.Offset(, 2).Resize(1, 8).ClearContents
    End If
    
    Application.EnableEvents = True
End Sub

Inserting End If still turns up an error except now it is whenever I enter anything anywhere pulling up the no End If error.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False

If Target.Cells.Count > 1 Then
MsgBox "Change only one cell at a time"
Application.Undo
Application.EnableEvents = True
Exit Sub
End If

If Not Intersect(Target, Range("A:A")) Is Nothing And Target.Value = "" Then
Target.Offset(, 2).Resize(1, 8).ClearContents
End If

Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,272
Members
449,219
Latest member
daynle

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