vba - Stop code from copying header -
i have been tweaking following vba code copies data sheet new sheets bases on code in column. hang not have headers code copies first line new sheets. how change code not header?
sub parse_data() dim lr long dim ws worksheet dim vcol, integer dim icol long dim myarr variant dim title string dim titlerow integer vcol = 5 set ws = activesheet lr = ws.cells(ws.rows.count, vcol).end(xlup).row title = "a1:aa1" titlerow = ws.range(title).cells(1).row icol = ws.columns.count ws.cells(1, icol) = "unique" = 2 lr on error resume next if ws.cells(i, vcol) <> "" , application.worksheetfunction.match(ws.cells(i, vcol), ws.columns(icol), 0) = 0 ws.cells(ws.rows.count, icol).end(xlup).offset(1) = ws.cells(i, vcol) end if next myarr = application.worksheetfunction.transpose(ws.columns(icol).specialcells(xlcelltypeconstants)) ws.columns(icol).clear = 2 ubound(myarr) ws.range(title).autofilter field:=vcol, criteria1:=myarr(i) & "" if not evaluate("=isref('" & myarr(i) & "'!a1)") sheets.add(after:=worksheets(worksheets.count)).name = myarr(i) & "" else sheets(myarr(i) & "").move after:=worksheets(worksheets.count) end if ws.range("a" & titlerow & ":a" & lr).entirerow.copy sheets(myarr(i) & "").cells(rows.count, 1).end(xlup)(2) sheets(myarr(i) & "").columns.autofit next ws.autofiltermode = false ws.activate end sub
i think can try:
ws.range("a" & titlerow + 1 & ":a" & ...
this skips titlerow in copy. (these things hard sure of not having sheet.)
Comments
Post a Comment