vba - Have Excel switch to next row if first row is populated -
i'm learning excel vba , hit wall.
i have spreadsheet in built userform. userform populates row 14 ak.
now i've been able copy data form using code (part of it's way long copy here):
'date sheet1.range("a14") = dtpicker1 'ac type sheet1.range("b14") = combobox1 'ac reg sheet1.range("c14") = textbox3 'pic sheet1.range("d14") = textbox5 'co-pilot sheet1.range("e14") = textbox4 'from sheet1.range("f14") = textbox7 'to sheet1.range("g14") = textbox6 'remarks sheet1.range("h14") = textbox8
now if a14 populated, writes in 14 switches 15, , on.
is there way can this?
something along these lines should work (untested):
static rng range if rng nothing set rng = sheet1.range("a14") while rng.value <> "" set rng = rng.offset(1) loop end if 'date rng.range("a1").value = dtpicker1 'ac type rng.range("b1").value = combobox1 'ac reg rng.range("c1").value = textbox3 'pic rng.range("d1").value = textbox5 'co-pilot rng.range("e1").value = textbox4 'from rng.range("f1").value = textbox7 'to rng.range("g1").value = textbox6 'remarks rng.range("h1").value = textbox8 'point next line set rng = rng.offset(1)
Comments
Post a Comment