vba - Code run automatically on changing cell value in Excel -
i trying run vba script run automatically when change cell value automatically. have script int worksheet , not module. reason not working , can't figure out why. have idea why? much!
private sub worksheet_change(byval target range) if target = range("b1") r1 = range("b1").value range("a1").value = 2 * r1 end if end sub
consider:
private sub worksheet_change(byval target range) if target.address(0, 0) = "b1" application.enableevents = false range("a1").value = 2 * range("b1").value application.enableevents = true end if end sub edit#1:
if fails work, not produce error message, may need re-enable events . put in standard module , run it:
sub eventson() application.enableevents = true end sub
Comments
Post a Comment