|
楼主 |
发表于 2023-6-17 09:32
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Dim cell As Range, Rng As Range
Dim sht As Worksheet
On Error Resume Next
For Each sht In Worksheets
Set Rng = sht.UsedRange.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If Rng Is Nothing Then
MsgBox "本表没有公式。", , appTitle
Exit Sub
End If
For Each cell In Rng.Cells
If InStr(cell.Formula, "[") Then cell.Value = cell.Value
Next cell
Next
MsgBox "本表上引用其它工作薄文件的所有公式已转换为数值。", , appTitle
照抄了以后,运行时卡在Set Rng = sht.UsedRange.SpecialCells(xlCellTypeFormulas)说找不到单元格 |
|