Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Test if a date falls within a given range of dates in Excel? lindaledb Excel Worksheet Functions 7 September 10th 08 05:52 PM
Test within a range? JC Excel Worksheet Functions 3 May 25th 07 03:41 AM
range as test mcolson Excel Programming 4 February 8th 07 10:31 AM
Can't test Range for Nothing Peter Chatterton[_4_] Excel Programming 3 June 16th 06 09:22 PM
== How to test if a range var contains nothing hcova[_2_] Excel Programming 3 October 25th 04 10:08 PM


All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"