excel - Copying template worksheet under two if conditions and naming sheet according to cell value -


i have list of companies in range d16:d40 under 2 reporting categories: quarterly or semi annually.

range j16:j40 states whether quarterly or semi annually reported.

i want copy template qtr or semi depending on stated value in range j16:j40. how can improve below formula work?

the macro below shows application defined / object defined error.

sub copyqtrsheetandinsert() ' ' copyqtrsheetandinsert macro '  dim rcell range dim rcell2 range dim background worksheet set background = activesheet  each rcell in range("d16:d49")     each rcell2 in range("j16:j49")          if rcell2.value = "qtr"              sheets("qtr").copy after:=sheets("semi")             sheets("qtr (2)").name = rcell.value          end if     next rcell2 next rcell  end sub 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -