0

I have the following code and it works well, however, I'd like to loop through a cell range and name the cells in the range with the cell value:

Sub NameCell()
Range("A2").Name = Range("A2").Value
End Sub
Community
  • 1
  • 1
  • see this link: [Loop through each cell in a range of cells](http://stackoverflow.com/questions/3875415/loop-through-each-cell-in-a-range-of-cells-when-given-a-range-object?rq=1) – Dmitry Pavliv Mar 08 '14 at 23:12

1 Answers1

1

Give this a try:

Sub NameMaker()
    For Each r In Selection
        With r
            .Name = .Value
        End With
    Next r
End Sub
Gary's Student
  • 95,722
  • 10
  • 59
  • 99