Copy specific columns into NEW workbook using VBA in Excel -
i total rookie @ please gentle lol.
i have workbook 2 sheets, concerned sheet1 function.
sheet 1 has bunch of columns, need data columns , g. need copy columns new workbook. did using following code found on site
sub dural() dim r1 range, r2 range sheets(1).select set r1 = range("a:a") set r2 = range("g:g") set wbnew = workbooks.add r2.copy range("a1") r1.copy range("b1") end sub
this did needed automatically create , save output new file, preferably in specific directory. don't need open , displayed above code does. lets call output.xlsx. original file source.xlsm
thank kindly :)
something simple this:
sub dural() workbooks.add thisworkbook.sheets(1).range("g:g").copy .sheets(1).range("a1") thisworkbook.sheets(1).range("a:a").copy .sheets(1).range("b1") .saveas "your path + filename here" .close end end sub
should want.
if still have questions, ask :)
Comments
Post a Comment