excel - Avoid creation of duplicate sheet -
i trying make macro make budgets. have different business units multiple cost centers. want circulate macro enabled worksheet different business units , make budget predefined parameters.
while doing setup, user selects business unit, available cost centers under same business unit creates 1 sheet each predefined names. problem is, if user go same setup again , select same business unit, show run time error sheet name cannot changed 1 sheet same name exist.
i tried use on error function, new sheet created eg: sheet16.
my requirement either continue file if nothing happened or pop msgbox predefined error message without creating new blank sheet.
any ideas?
you can first check if sheet exists , handle situation. can use following loop:
for each in activeworkbook.sheets s = i.name ' name next
Comments
Post a Comment