I have 3 probabilities and associated dates in columns H,K,N. The following rules should take place - If a cell in column H is 2005, a date in a cell in column K should be greater than column H and following on N should be greater than K (and H) .e.g
2005 2006 2007 = correct
2005 2002 2008 = incorrect
2005 2006 2006 = incorrect
How would I write a macro to be able to execute a pop up box if this rule hasnt been followed. I use data validation in these columns by making a custom list i dont know if this helps. I thought it would be easier to create 2 VBA codes - 1 to compare columns K and H and one to compare columns K and N.
Ive had a go but its not working
Any ideas?Private Sub worksheet_CHECKdates() For MY_ROWS = 2 To Range("H65536").End(xlUp).Row If Range("H" & MY_ROWS).Value > Range("K" & MY_ROWS).Value Then MY_CHOICE = MsgBox("date error found in column H/K") End If End If Next MY_ROWS End Sub
Thanks