database - Button to copy paste in Excel -
ok write words in cells c3 c9. want button copies , pastes 6 blocks cells h3 h9.
i did code this.
sub save_click() range("c3:c9").copy range("h3:h9").pastespecial end sub
but need program register if cells h3 h9 empty or not , if aren't empty should paste cells i3 i9 , if aren't empty should paste in cells j3 j9 , on , on...
i found other forums i'm complete noob in , didn't had do. if knows have thankful.
you need rely on simple loop; cells
makes things easier range
letters on it. here have sample code:
sub save_click() range("c3:c9").copy dim currange range dim curcol integer: curcol = 7 dim completed boolean: completed = false curcol = curcol + 1 set currange = range(cells(3, curcol), cells(9, curcol)) if (worksheetfunction.counta(currange) = 0) exit end if loop while (not completed) currange.pastespecial end sub
Comments
Post a Comment