• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Merged Cell Data Validation Worsksheet Change Event

chirayu

Well-Known Member
Hi All,

Cell H49:I49 are merged & H50:I50 are merged & both have Data Validation lists

In merged cell H49:I49 there is a list that has "Yes" and "No"
In merged cell H50:I50 there is a list that has multiple reasons - one of which is "Not Resolved"

What I would like to do is add a Worksheet Change event whereby if merged cell H49:I49 is set to "No", then the value for merged cell H50:I50 should be automatically changed to "Not Resolved".

I have created a macro for the same but it keep throwing an error and asks me to debug or end.

So please help with the same:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("H49:I49").Value = "NO" Then
Range("H50:I50").Value = "NOT RESOLVED"
Else
End If
End
End Sub
 
Resolved the above but faced another issue - extended my code to below and it won't run the second piece of code for H51 onwards

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("H49").Value = "NO" Then
  Range("H50").Value = "NOT RESOLVED"
Else
End
End If
End
 
If Range("H51").Value = "NO" Then
 Range("H52").Value = "NA"
 Range("H53").Value = "NA"
 Range("H54").Value = "NA"
 Range("H55").Value = "NA"
 Range("H56").Value = "NA"
Else
End
End If
End
 
End Sub
 
Last edited:
Resolved the above too :D

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("H49").Value = "NO" Then
  Range("H50").Value = "NOT RESOLVED"
Else
End
End If
 
If Range("H51").Value = "NO" Then
  Range("H52").Value = "NA"
  Range("H53").Value = "NA"
  Range("H54").Value = "NA"
  Range("H55").Value = "NA"
  Range("H56").Value = "NA"
Else
End
End If
End 'The END part after END IF is critical and cannot be used with END IF used above or it won't run rest of the code
 
End Sub
 
Back
Top