excel - Add macro code to a worksheet through a module -


i have macro created takes large amount of data (pulled database weekly) , displays in multiple different pivot tables. have summary page @ start of workbook listing different customer , machine names. have macro written can click on 1 of customer names , opens sheet corosponding customer via worksheet_selectionchange event.

private sub worksheet_selectionchange(byval target range)     if sheetexists(right(replace(replace(activecell.value, "/", "-"), "'", ""), 31))         activeworkbook.sheets(right(replace(replace(activecell.value, "/", "-"), "'", ""), 31)).activate     end if end sub  function sheetexists(sheetname string, optional wb excel.workbook)    dim s excel.worksheet    if wb nothing set wb = thisworkbook    on error resume next    set s = wb.sheets(sheetname)    on error goto 0    sheetexists = not s nothing end function 

unfortunatly due nature of job, can't share of code itself.

my problem lies when report re generated next week: possible have macro generates detailed sheets , summery add selectionchange code new summary? thanks!

a template seemed best option this

thanks!


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -