怎样使用VBA删除工作表中数据链接?
1、首先在开发工具中打开VBA编辑器

2、在单元格区域当中输入一些内容作为例子

3、在VBA编辑器中插入模块

4、在模块当中输入如下代码,然后运行
Sub 删除与其他工作簿之数据链接()
Dim Cell As Range, FirstAddress As String
Application.ScreenUpdating=False
With ActiveSheet.UsedRange
Set Cell=.Find("=*!", LookIn:=xlFormulas, searchorder:=xlByRows,
LookAt:=xlPart, MatchCase:=True)
On Error GoTo err
FirstAddress=Cell.Address
Do
Cell=Cell.Value
Set Cell=.FindNext(Cell)
Loop Until Cell Is Nothing Or Cell.Address=FirstAddress
End With
Application.ScreenUpdating=True
err:
End Sub

5、利用快捷键Alt+F8调出运行宏窗口,然后单击“执行”按钮,第三列公式全部转换成值,第二列公式不变,

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:189
阅读量:130
阅读量:106
阅读量:58
阅读量:60