![]() |
VBA Excel range name test
Is it possible to test in VBA whether a rangename (created in excel) exists?
And therefore run a macro which then deletes only those rangenames which already exist . Do not wish to dlete all range names just a selection. This is because the macro creates rangenames to use in the procedure for copying/formula/prints etc various bits of information and depending how long the datasheet is the number of ranges may be anything from 1 to 10 but i wish to start the macro always with none of the "macro created" range names from its previous execution existing |
VBA Excel range name test
Why not just delete your selected names, existing or not?
On Error Resume Next Activeworkbook.Names("name1").Delete Activeworkbook.Names("name2").Delete On Error Goto 0 -- __________________________________ HTH Bob "Marie" wrote in message ... Is it possible to test in VBA whether a rangename (created in excel) exists? And therefore run a macro which then deletes only those rangenames which already exist . Do not wish to dlete all range names just a selection. This is because the macro creates rangenames to use in the procedure for copying/formula/prints etc various bits of information and depending how long the datasheet is the number of ranges may be anything from 1 to 10 but i wish to start the macro always with none of the "macro created" range names from its previous execution existing |
VBA Excel range name test
Thankyou - This works well
"Bob Phillips" wrote: Why not just delete your selected names, existing or not? On Error Resume Next Activeworkbook.Names("name1").Delete Activeworkbook.Names("name2").Delete On Error Goto 0 -- __________________________________ HTH Bob "Marie" wrote in message ... Is it possible to test in VBA whether a rangename (created in excel) exists? And therefore run a macro which then deletes only those rangenames which already exist . Do not wish to dlete all range names just a selection. This is because the macro creates rangenames to use in the procedure for copying/formula/prints etc various bits of information and depending how long the datasheet is the number of ranges may be anything from 1 to 10 but i wish to start the macro always with none of the "macro created" range names from its previous execution existing |
All times are GMT +1. The time now is 05:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com