View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default named ranges in a For Loop


TRY,

Dim n As Name
For Each n In ThisWorkbook.Names
If Left(n.Name, 4) = "ques" Then
Range(n).ClearContents
End If
Next

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


" wrote:

I have named ranges in a worksheet (ques1, ques2,etc.). I need a loop
to clear the contents of these ranges, something like:

For i = 1 To 60
Range("ques & i").Select
Selection.ClearContents
Next i

Any suggestions on how to make this work?