VBA在更改外部链接时运行速度非常慢

我有一个Excel文件,其中单元格A1包含公式:

=C:\folder1\[1.xls]Sheet1!A1 

而对于H100以下的所有细胞来说都是相对的。

现在我想改变A1的公式(对于其他单元格H100也是如此)

 =C:\folderA\[A.xls]Sheet1!A1 

最初我通过查找和replace语句logging了一个macros

 Sub replace() Application.EnableEvents = False Application.Calculation = xlCalculationManual Range("A1:H100").replace What:="folder1\[1.xls]", Replacement:="folderA\[A.xls]", _ LookAt:= xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Application.EnableEvents = True End Sub 

但是,这需要10多分钟,在Excel的左下angular,它说:“链接:—”(加载…)

有其他的方法吗?

尝试一下( 这需要不到一秒钟

 Sub ReplaceInaFormula() Application.ScreenUpdating = False Application.EnableEvents = False Application.DisplayAlerts = False Dim c As Range For Each c In Range("A1:H100") c = Replace(c.Formula, "folder1\[1.xls]", "folderA\[A.xls]") Next Application.DisplayAlerts = True Application.EnableEvents = True Application.ScreenUpdating = True End Sub