excel - create VBA for copy and adding sheet 2 while copy paste row in first sheet1 -
question.
i need vba code copy complete worksheet when inserting copied row in first sheet. example: sheet one; row a1:n1 has formulas, combined sheet 2.
now copied row a1:n1 a2:n2 module needs copy sheet 2 , insert after it. whit formulas combined row a2:n2 sheet 1..
and on..
is possible??
in "wp sample 1";
row a14 "wps 1" linkt "worksheet wps1" (wps sample 2) row a15 "wps 2" linkt "worksheet wps2"
-i want create "wps 3", going copy row 14 , paste info under 15.
this vba needs copy "worksheet "wps1" , ad copy after worksheet "wps2"
so creates wps3, need have same formulas in "wps1"
thnx in advanced.
mitch
you can try similar procedure:
public sub copywps1asnew()     dim nameinput string  requestname:     nameinput = application.inputbox(prompt:="type new name of wps.", title:="wps name", default:="wps2", type:=2) 'type:=2 string      'check if name taken     dim ws worksheet     each ws in worksheets         if ws.name = nameinput             msgbox "that name taken. try different one.", vbexclamation, "try different name"             goto requestname         end if     next      'create new sheet     dim newws worksheet     worksheets("wps1").copy after:=worksheets(worksheets.count)     set newws = worksheets(worksheets.count)     newws.name = nameinput end sub   some custom tweeks needed maybe. hope gets started.
 check if name taken part can made custom function, make code more reusable.
Comments
Post a Comment