excel - How I copy multiple worksheet and multiple chart obj sheet to another workbook -
excel - How I copy multiple worksheet and multiple chart obj sheet to another workbook -
sub cpysht2nwb() dim bkname string dim numsht integer dim begsht integer begsht = 1 numsht = activeworkbook.worksheets.count bkname = activeworkbook.name set newbook = workbooks.add newbook .saveas filename:="c:\e2eperformance\test.xlsm", fileformat:=xlopenxmlworkbookmacroenabled end x = 1 numsht workbooks(bkname).sheets(x).move _ before:=workbooks("test.xlsm").worksheets(x) next
end sub
it procedure error:
run-time error '1004': excel cannot insert sheet destination workbook, because contains fewer rows , column source workbook. move or re-create info destination workbook, can select data, , utilize re-create , paste commands insert sheets of workbook.
suppose: have 10 worksheet , 10 chart object sheet how can prepare this?
try alter end : , if have charts sheets, worksheets won't include them, utilize sheets
sub cpysht2nwb() dim bkname string dim numsht integer dim begsht integer dim newbook workbook begsht = 1 numsht = activeworkbook.worksheets.count bkname = activeworkbook.name set newbook = workbooks.add newbook .saveas filename:="c:\e2eperformance\test.xlsm", fileformat:=xlopenxmlworkbookmacroenabled end x = 1 numsht workbooks(bkname).sheets(x).move _ before:=newbook.worksheets(newbook.worksheets.count) next x end sub
excel vba excel-vba
Comments
Post a Comment