我有2列数据。在列上有单元格名称(B63,J63,P63 ...),另一列有值。我想要一种方法来将每个值列在相邻的命名单元格中。
示例:单元格A1包含B63。单元格B1包含1.08274。我想编写一个将1.08274分配给B63的宏。
该列长达数百个条目,我不想手工完成。任何想法怎么做?
答案 0 :(得分:1)
尝试一下:
Sub dural()
Dim N As Long, L As Long, addy As String
N = Cells(Rows.Count, "A").End(xlUp).Row
For L = 1 To N
addy = Cells(L, 1).Value
Range(addy).Value = Cells(L, 2).Value
Next
End Sub
修改强>
同时获得价值和价值格式,我们将做一个真正的副本:
Sub sequel()
Dim N As Long, L As Long, addy As String
N = Cells(Rows.Count, "A").End(xlUp).Row
For L = 1 To N
addy = Cells(L, 1).Value
Cells(L, 2).Copy Range(addy)
Next
End Sub