Find next empty row for automatic data entry from excel userform -
private sub commandbutton1_click() nextrow = 2 sheets("data").cells(nextrow, 2) = sheets("data").cells(nextrow, 3) = sheets("sheet1").cells(nextrow, 2) sheets("data").cells(nextrow, 4) = thisworkbook.sheets("sheet1").range("b3") sheets("data").cells(nextrow, 5) = thisworkbook.sheets("sheet1").range("b4") sheets("data").cells(nextrow, 6) = thisworkbook.sheets("sheet1").range("b5") sheets("data").cells(nextrow, 7) = thisworkbook.sheets("sheet1").range("b6") sheets("data").cells(nextrow, 8) = thisworkbook.sheets("sheet1").range("b7") sheets("data").cells(nextrow, 9) = thisworkbook.sheets("sheet1").range("b8") sheets("data").cells(nextrow, 10) = thisworkbook.sheets("sheet1").range("b10") sheets("data").cells(nextrow, 11) = thisworkbook.sheets("sheet1").range("b11") sheets("data").cells(nextrow, 12) = thisworkbook.sheets("sheet1").range("b12") end sub
here code. whenever keep on giving value overrides. how change it? how make entry in seperate row?
you pop little loop in discover next empty row, example (untested!):
nextrow=2 until sheets("data").cells(nextrow,2) = "" nextrow = nextrow + 1 loop
Comments
Post a Comment