If specific cell is changed and contains specific phrase then change other cells

tomleitch

Board Regular
Joined
Jan 3, 2012
Messages
189
Hi,

I am trying to make a worksheet change other cells to "N/A" if cells contain a specific text.

For example if any cell in range J10:J5010 is changed then cells offset to the right "S, T and V" columns of that particular row are changed to N/A.

I was thinking I could do this on the Worksheet_Change(ByVal Target As Range) code that I have??


Thanks
Tom
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I have the below script working like you wanted if you make any change to column J below row 10

Now you said:
I am trying to make a worksheet change other cells to "N/A" if cells contain a
specific
text.

But then you said:
For example if any cell in range J10:J5010 is changed
.

So if the cell must have a specific Text then I need to know what specific text.

Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  8/24/2018  4:40:01 AM  EDT
If Target.Column = 10 And Target.Row > 9 Then
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
Dim ans As Long
ans = Target.Row
Application.Union(Cells(ans, 19), Cells(ans, 20), Cells(ans, 22)).Value = "NA"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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