Excel VBA user-form update button -


update button works if there value in cells beside target cell can not find problem in code.

private sub commandbutton3_click() dim irow long, _ ws worksheet, _ nextrow long, _ cf range set ws = worksheets("stock") ws     .range("a:a")          set cf = .find(what:=me.combobox2.value, _                 after:=.cells(1, 1), _                 lookin:=xlvalues, _                 lookat:=xlwhole, _                 searchorder:=xlbyrows, _                 searchdirection:=xlnext, _                 matchcase:=false, _                 searchformat:=false)     end   if not cf nothing     if cf.offset(0, 1) <> vbnullstring         set cf = cf.end(xltoright).offset(0, 25)         cf.value = me.textbox2.value + .cells(cf.row, "aa").value     end if  else    .cells(cf.row, "aa").value = me.textbox2.value + .cells(cf.row,   "aa").value  end if 

end end sub

if target cell aa2 there should value in z2 or b2 otherwise nothing happens.

just added else statement else updating value in column ab not in aa

form

i did on basis of hit n trial , works

   `private sub commandbutton3_click()     dim irow long, _     ws worksheet, _     nextrow long, _    cf range    set ws = worksheets("stock")    ws    .range("a:a")      set cf = .find(what:=me.combobox2.value, _             after:=.cells(1, 1), _             lookin:=xlvalues, _             lookat:=xlwhole, _             searchorder:=xlbyrows, _             searchdirection:=xlnext, _             matchcase:=false, _             searchformat:=false)   .cells(cf.row, "aa").value = me.textbox2.value + .cells(cf.row,   "aa").value  end  end sub` 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo