excel - VBA code to show message box popup if the formula in the target column exceeds a certain value -
i found code on site particular cell
private sub worksheet_change(byval target range) if range("a1") > 0.5 msgbox "discount high" end if end sub
but wondering if possible make work entire column rather 1 particular cell?
try event code:
private sub worksheet_calculate() dim rr range, r range set rr = range("a:a").cells.specialcells(xlcelltypeformulas) each r in rr if r.value > 0.5 msgbox "discount high" end if next r end sub
edit#1:
if want restrict message single row, remove first sub , replace with:
private sub worksheet_change(byval target range) rt = target.row if range("a" & rt) > 0.5 msgbox "discount high" end if end sub
Comments
Post a Comment