View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default named ranges in a For Loop

yep, clearly stated in my original post.

--


Gary


"Chip Pearson" wrote in message
...
Sub Clear_rnge()
For Each nm In ThisWorkbook.Names
Range(nm).ClearContents
Next
End Sub


This will clear the contents of ALL names, not just those beginning with
"ques", as the original poster wanted.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



wrote in message
oups.com...
I'M SORRY! I had forgotton I had already posted this. Jim's solution
gives a Method 'Range' of object '_Global' failed. Chip's solution is
almost the same as Jim's. Gary's earlier solution works wonderfully:

Sub Clear_rnge()
For Each nm In ThisWorkbook.Names
Range(nm).ClearContents
Next
End Sub

Please accept my appologies for double posting and thanks for the help.