[英]How do I loop through a cell range and name the cells with cell value in vba?
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
Give this a try: 试试看:
Sub NameMaker()
For Each r In Selection
With r
.Name = .Value
End With
Next r
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.