excel vba - What VBA coding in a Userform can I use to find a cell based upon row & column content, and then update that cell? -


i complete beginner vba, truely.

i trying create user form update number of tasks person completes on given date listed on spreadsheet. envision userform having 2 bottons (which hidden , appear conditions of subroutine). working on mac, way, , know have vba coding implications use on pc och vice versa.

the example sheet this:

sample, simple spreadsheet table want search , update userforms , vba

the example userform (a) this:

first stage of user form userform serch sheet person , date , retrieve number of tasks in appropriate cell

for argument's sake, let want update or input number of tasks greg completed on 7th of may (2013/05/07).

i userform proceed this:

entering person , date:

enter image description here

then, retrieving number of tasks greg on 7th after button click:

enter image description here

now, want input know greg completed 6 tasks on 7th , click second button (now visible , first button hidden):

enter image description here

and result in spreadsheet:

enter image description here

i ought input code here, skills , completeness of code wanting. put in have:

option explicit  'subroutine when clicking first ("find") button private sub btnfind_click()     lbltasks.vissible = true     txttasks.visible = true     btnupdate.visible = true     btnfind.visible = false  'defining variables     dim pr01 string     dim dt01 date     dim tsk01 integer  'assigning variables inputs     pr01 = txtperson.text     dt01 = txtdate.text     tsk01 = txttask.text  'looking name in column "a"     ' ? ? ?  'looking inut date in row "1"     ' ? ? ?  'retrieving existing number of tasks according name , date 'and showing number in 'tasks' text input box in user form      ' ? ? ? end sub  'subroutine when clicking second ("update") button private sub btnupdate_click()  'paste updated number of tasks in appropriate cells according name , date 'the new number of tasks should on write there     ' ? ? ?  end sub 

thanks in advance , help!

this should work. please study , use macro record function in excel grasp lot more:

option explicit public frmname variant 'store row of name public frmdate variant 'store column of date  'subroutine when clicking first ("find") button private sub btnfind_click() 'defining variables     dim pr01 string     dim dt01 date     dim tsk01 integer  'assigning variables inputs     pr01 = userform1.textbox1.text     dt01 = userform1.textbox2.text     tsk01 = userform1.textbox3.text  'looking name in column "a"     thisworkbook.worksheets("sheet4")         frmname = .columns("a").find(pr01).row     end   'looking inut date in row "1"     thisworkbook.worksheets("sheet4")         frmdate = .rows(1).find(cdate(dt01)).column     end      if frmname nothing or frmdate nothing         'not found         exit sub     end if  'retrieving existing number of tasks according name , date 'and showing number in 'tasks' text input box in user form     thisworkbook.worksheets("sheet4")         userform1.textbox3.text = .cells(frmname, frmdate)     end  end sub  'subroutine when clicking second ("update") button private sub btnupdate_click()  'paste updated number of tasks in appropriate cells according name , date 'the new number of tasks should on write there     thisworkbook.worksheets("sheet4")         .cells(frmname, frmdate) = userform1.textbox3.text     end end sub 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -