excel - Message box pop up -


i need build code give me pop message if value of cell (price) bigger cell (target). if price > target pop window (ideally sound).

also if i hit ok need register "true" cell or if hit cancel insert cell false

my first vba code please show understanding, lot in advance.

private sub commandbutton1_click()  sub userinput()  dim ireply integer  if range("c6").value > range("e6").value  ireply = msgbox(prompt:="price" & range("f6").value & " reached target. stop tracking ?", buttons:=vbyesnocancel, title:="tracking")  if ireply = vbyes  range("b6").value = "true"  elseif ireply = vbno  range("b6").value = "false"  end ifs  if range("c7").value > range("e7")  end if  if range("c8").value > range("e8")  end if  exit sub  end sub 

to make possible directly when input data excel, you'll need place sheet module of sheet want work on :

private sub worksheet_change(byval target range) dim ireply integer  if target.count > 1 exit sub  if application.intersect(target, columns(3)) nothing else     if range("c" & target.row).value > range("e" & target.row).value         beep         ireply = msgbox("price" & range("f" & target.row).value & " reached target. stop tracking ?", vbokcancel + vbcritical, "tracking")         if ireply <> vbcancel             range("b" & target.row).value = "true"         else             range("b" & target.row).value = "false"         end if     else     end if end if  end sub 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -