excel - Copy active row from one worksheet table to another -


i have sheet 1 (formatted table) , sheet 2 (formatted table). want copy active row from sheet 1 sheet 2. have tried below , works normal range not sheets formatted table.

private sub commandbutton1_click() dim lastrow long  thisworkbook.worksheets("sheet2")     lastrow = application.max(4, .cells(.rows.count, "b").end(xlup).row + 1)     .range("b" & lastrow).resize(, 5).value = _         range("a" & activecell.row).resize(, 5).value end end sub 

update:

private sub commandbutton1_click()     dim tbl listobject     dim tblrow listrow     dim lastrow long      if ucase(range("f" & activecell.row)) <> "yes" exit sub      thisworkbook.worksheets("sheet3")         'change sheet3 destination sheet - need paste values          if not iserror(application.match(range("b" & activecell.row), .range("b:b"), 0)) exit sub          set tbl = .listobjects(1)         if tbl.range(tbl.range.rows.count, "b") = ""             lastrow = application.min(tbl.range(tbl.range.rows.count, "b").end(xlup).row + 1, _                     application.max(4, .cells(.rows.count, "b").end(xlup).row + 1))         else             lastrow = tbl.listrows.add.range.row         end if      end     tbl.range(lastrow, "b").resize(, 5).value = _             range("a" & activecell.row).resize(, 5).value end sub 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -