How to Display a message box in excel vba when value in a cell exceeds another? -


i need message box appear when value in cell g27 exceeds value in cell k13. require show cell g27 filled. have tried following macro, not working.

private sub worksheet_change(byval target range)     if range("g27") > range("k13")         msgbox "error"     end if end sub 

any highly appreciated!

is trying? (untested) understood have code in sheet code area , not module :)

private sub worksheet_change(byval target range)     on error goto whoa      application.enableevents = false      if not intersect(target, range("g27")) nothing _     if range("g27").value > range("k13").value msgbox "error"  letscontinue:     application.enableevents = true     exit sub whoa:     msgbox err.description     resume letscontinue end sub 

more worksheet_change here


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -