View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default named ranges in a For Loop

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.