View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Loop using cell names

Matt

this example demonstrates how to loop around the cells:

Sub LoopRoundCellNames()
Dim i As Long
For i = 1 To 30
On Error GoTo CellExit
MsgBox Range("Cell" & i).Name.Name & _
" " & _
Range("Cell" & i).Address
Next 'i
CellExit:
End Sub

What do you mean by "protect the cells"? The cells will be protected
(locked) by default but you need to protect the sheet for this to have any
effect.

Regards

Trevor


"Matt" wrote in message
...
I have a group of cells that I have renamed. They are cell1,cell2,cell3

and so on up to 30. Is it possible to take the cell names and extract the
number in the cell name so that I can use the number in a loop. I would
like to protect these cells as the loop progresses. Thanks.