Excel 2010 data validation to check if cell contain comma value -
in excel 2010, how validation if cell contain ',' pop message user ?
if want avoid unnecessary loop use below code.
sub findcomma() dim srcrng range, findrng range dim firstcell string dim lrow integer lrow = range("a" & rows.count).end(xlup).row set srcrng = range("a1:a" & lrow) set findrng = srcrng.find(what:=",", lookin:=xlvalues, lookat:=xlpart) if not findrng nothing firstcell = findrng.address until findrng nothing msgbox (findrng.address & " contains comma ") findrng.interior.color = vbred set findrng = srcrng.findnext(findrng) if findrng.address = firstcell exit sub loop end sub
Comments
Post a Comment