View Single Post
 
Old 05-18-2017, 08:18 PM
YW3 YW3 is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2017
Posts: 10
YW3 is on a distinguished road
Default

Oh! I'm so sorry, I forgot to mention that I'm not applying it to just one cell. A2:F2, in which A2 and B2 are merged, C2 is an un-merged cell, D2 and E2 are merged, and F2 is another un-merged cell. So it's actually 4 cells that needs to auto-populate '0'.

I've been editing the code to add in :F2. Is that the error?

I'm so sorry I missed this out.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
        If Range("A1").Value = "No" Then
            Range("A2:F2").Value = 0
            Range("A2:F2").Locked = True
        Else
            Range("A2:F2").Value = ""
            Range("A2:F2").Locked = False
        End If
    End If

End Sub
Edit: I tried it again with just one cell only (test both merged and un-merged), it still didn't work. I don't know what the problem is then.

Last edited by YW3; 05-18-2017 at 11:38 PM.
Reply With Quote