Worksheet event is not working in a particular sheet

ajo_5895

New Member
Joined
Dec 29, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
I have written code for the actions to be performed based on dropdown option that you are selecting.
if you select "Yes", the row from Columns B:N will high-light yellow. If you then type something else into any of the Columns B:N in an already high-lighted row(and then click away or Tab or move to another cell), the row color will immediately return to normal. Hence, an event has to happen in a cell for the code to execute. Sharing file which somewhat looks like this and all the columns depend on each other.

Ajo.xlsm

Option Compare Text

Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Columns("B:N")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
x = Target.Row

If Target.Value = "Yes" And WorksheetFunction.CountA(Range("C" & x).Resize(, 12)) = 0 Then
Range("C" & x).Resize(, 12).Interior.ColorIndex = 6
ElseIf Target.Value = "No" Then
Range("C" & x).Resize(, 12).Value = "N/A"
End If
If Target.Column <> 2 Then
Target.Interior.ColorIndex = xlNone
End If

End Sub

This code is working perfectly fine in the other sheets but not into my worksheet which has n number merged cells.
Can anybody please help me with this ASAP.

Thanks,
Anu
 
Peter, Mumps & Afonsomira.

Please note that this has been cross-posted here:-


@Ajo:-

Be aware that you did not write the code as per your opening post. Even your comments were extracted directly from mine!

You were given help towards a solution, including (as per Mumps advice) advice about merged cells. You abandoned the thread without acknowledgement.

How sad.
Thanked you there itself. It still did not solve the question so I thought of asking it here. I am sorry for copying your code.
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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