1、导出定义名称
Sub NamesListsOut()
Dim i As Integer
With ActiveWorkbook
For i = 1 To .Names.Count
Cells(i, 1).Value = .Names(i).Name
Cells(i, 2).Value = "'" & .Names(i).RefersToLocal
Next i
End With
End Sub
2、导入定义名称
Sub NamesListsIn()
Dim n As Name
Dim i As Integer
With ActiveWorkbook
'删除既存
For Each n In .Names
n.Delete
Next n
'导入新的
On Error Resume Next
For i = 1 To Range("A65536").End(xlUp).Row
.Names.Add Cells(i, 1).Value, Cells(i, 2).Value
Next i
On Error GoTo 0
End With
End Sub
Sub NamesListsOut()
Dim i As Integer
With ActiveWorkbook
For i = 1 To .Names.Count
Cells(i, 1).Value = .Names(i).Name
Cells(i, 2).Value = "'" & .Names(i).RefersToLocal
Next i
End With
End Sub
2、导入定义名称
Sub NamesListsIn()
Dim n As Name
Dim i As Integer
With ActiveWorkbook
'删除既存
For Each n In .Names
n.Delete
Next n
'导入新的
On Error Resume Next
For i = 1 To Range("A65536").End(xlUp).Row
.Names.Add Cells(i, 1).Value, Cells(i, 2).Value
Next i
On Error GoTo 0
End With
End Sub