arrays - Loop through user defined Sheets in a workbook -
please check problem...
about workbook: has 13 sheets sheet1 "master" , rest 12 named month "apr","may"...etc...till "mar".....
in "master" sheet user can defined month wants format..user can defined values like("apr","na","mar")... code should read values enter user , format sheets match month name , skip na.
what code should do:
1) vba should check values in cells o7 o18 user defined values (apr,mar,jan,na)
2) code should go worksheet names apr mar , skip na..
sub copyd() dim apr string dim may string 'similarly months till mar' apr = cells(7, 15).value may = cells(8, 15).value 'assigned cell value month till mar(cell contains values 'like (ex: apr,jan,na) user defined dim months variant dim month variant months = array(jan, feb, mar, apr, may, jun, jul, _ aug, sep, oct, nov, dec) activesheet.name = months each month in months 'formatting code here next month end sub
try this:
dim wshsrc worksheet, wshdst worksheet dim integer, wshname string on error resume next set wshsrc = thisworkbook.worksheets("master") = 7 18 wshname = wshsrc.range("o" & i) set wshdst = thisworkbook.worksheets(wshname) if err.number = 9 'worksheet not exists (na) err.clear() goto skipnext end if 'here code copy id's skipnext: ' next
Comments
Post a Comment