VBA Code for copying and pasting data from one sheet to another based on column headers -
VBA Code for copying and pasting data from one sheet to another based on column headers -
on sheet 1,in workbook1 cells a1:e1 have column headings, no data. on sheet 1 of workbook2, info range a1: ac5000. want pick out columns in worksbook match headers on workbook1, re-create , paste them under column headers in workbook1. can help me please
dim c range dim rng range dim integer
dim r range wscopyfrom1.range("a1").currentregion each r in wscopyto1a.range("a1:g1") set c = .rows(1).find(r.value, , , xlwhole, , 0) if not c nil .columns(c.column).copy r.pastespecial xlpastevalues end if next application.cutcopymode = false end
this works
vba header match copy-paste
Comments
Post a Comment