VBA on new Excel file -
i receive reports daily in spreadsheet form. have macro code take out portions of spreadsheet , put new spreadsheet. want know if there's way run macro without having manually copy paste each new file receive.
sub copyitover() dim newbook workbook set newbook = workbooks.add thisworkbook.worksheets("sheet1").range("fe1:fh1").copy destination:=newbook.worksheets("sheet1").range("a1:d1") thisworkbook.worksheets("sheet1").range("iz1:ji1").copy destination:=newbook.worksheets("sheet1").range("e1") thisworkbook.worksheets("sheet1").range("jk1:jl1").copy destination:=newbook.worksheets("sheet1").range("o1") thisworkbook.worksheets("sheet1").range("ka1:kj1, kl1, kr1, kt1").copy destination:=newbook.worksheets("sheet1").range("q1") thisworkbook.worksheets("sheet1").range("fe328:fh328").copy destination:=newbook.worksheets("sheet1").range("a2") thisworkbook.worksheets("sheet1").range("iz328:ji711").copy destination:=newbook.worksheets("sheet1").range("e2") thisworkbook.worksheets("sheet1").range("jk328:jl711").copy destination:=newbook.worksheets("sheet1").range("o2") thisworkbook.worksheets("sheet1").range("ka328:kj711, kl328:kl711, kr328:kr711, kt328:kt711").copy destination:=newbook.worksheets("sheet1").range("q2") columns("e").columnwidth = 15 columns("q").columnwidth = 15 end sub
when create macro , select option save personal macro workbook available every time start excel. or create custom toolbar button , attach macro it, there...
Comments
Post a Comment