forms - excel 2010: based on a radio button selection save user from date to ain a different worksheet -


i have excel form works , saves data 1 worksheet. able put radio button , based on selection save diffent work sheet. example: if radio button 1 selected save sheet1 if radio button 2 selected save sheet2 if radio button 3 selected save sheet3

same form used save on different worksheet.

the code im working with.

private sub btn_append_click()  dim irow long dim ws worksheet set ws = worksheets("assessment")  'find first empty row in database irow = ws.cells.find(what:="*", searchorder:=xlrows, _     searchdirection:=xlprevious, lookin:=xlvalues).row + 1  'check part number if trim(me.txt_roomnumber.value) = ""   me.txt_roomnumber.setfocus   msgbox "please enter room number"   exit sub end if  'copy data database 'use protect , unprotect lines, '     password '     if worksheet protected ws '  .unprotect password:="password"   .cells(irow, 1).value = me.txt_roomnumber.value   .cells(irow, 2).value = me.txt_roomname.value   .cells(irow, 3).value = me.txt_department.value   .cells(irow, 4).value = me.txt_contact.value   .cells(irow, 5).value = me.txt_altcontact.value   .cells(irow, 6).value = me.cbx_devices.value   .cells(irow, 7).value = me.cbx_wallwow.value   .cells(irow, 8).value = me.txt_existinghostname.value   .cells(irow, 10).value = me.cbx_relocate.value   if me.ckb_powerbar.value = true cells(irow, 11).value = "y"   if me.ckb_datajackpull.value = true cells(irow, 12).value = "p"   .cells(irow, 13).value = me.txt_existingdatajack.value   if me.ckb_hydropull.value = true cells(irow, 14).value = "p" else cells(irow, 14).value = "a"   .cells(irow, 19).value = me.txt_cablepulldesc.value   .cells(irow, 20).value = me.txt_hydropulldesc.value   .cells(irow, 21).value = me.txt_otherdesc.value '  .protect password:="password" end  'clear data 'me.txt_roomnumber.value = "" 'me.txt_roomname.value = "" 'me.txt_department.value = "" 'me.txt_contact.value = "" 'me.txt_altcontact.value = "" me.cbx_relocate.value = "" me.txt_existinghostname = "" me.txt_altcontact.setfocus  end sub  private sub btn_close_click()  unload me end sub  private sub combobox1_change()  end sub  private sub userform_click()  end sub  private sub userform_queryclose(cancel integer, closemode integer)  if closemode = vbformcontrolmenu     cancel = true     msgbox "please use close form button!"   end if end sub 

the first thing add radio-buttons (actually optionbutton) form , name them.

then check if 1 of them selected use code such as:

if optsheet1     'it checked elseif optsheet2     'the second 1 checked 'etc end if 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -