LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting Named Ranges

There is no guarantee that ReferstoRange will be defined for all names. If
you don't account for that, you can get an error.

Of course in this user's case, that may not be an issue.

--
Regards,
Tom Ogilvy

"Dana DeLouis" wrote in message
...
Here's just another general idea...

Sub Demo()
Dim nme As Name
Const ClearNamesOnThisSheet As String = "Sheet1"

For Each nme In ActiveWorkbook.Names
If StrComp( _
nme.RefersToRange.Parent.Name, _
ClearNamesOnThisSheet, _
vbTextCompare) = 0 Then
Range(nme).ClearContents
End If
Next nme
End Sub


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Ian" wrote in message
...
I has a worksheet with approx 20 separate named ranges. I
wish to clear the contents of all these ranges through VBA
in the most efficient way.

Is there a way of selecting all the named ranges within a
specifc worksheet so that I can apply ClearContents to all
the ranges at once.

Thanks.






 
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
Index and named ranges selecting difficulty Bruce Tharp Excel Worksheet Functions 7 June 19th 07 02:49 AM
Selecting Multiple Columns in a Named Selection Griffithpt Excel Worksheet Functions 0 August 9th 06 10:54 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
Selecting Filtered Items from Named range Soniya Excel Programming 2 August 20th 03 10:59 AM
selecting ranges MDC Excel Programming 1 July 24th 03 03:34 PM


All times are GMT +1. The time now is 07:50 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"