以下代码,特别是替换公式,在我取消注释包含.refreshAll语句的行之前,效果很好。工作簿按预期刷新,但替换功能现在不起作用。是否需要发出某种命令才能告诉Excel允许进一步处理?
注意:看起来它实际上会恰当地替换字符,但会立即将其更改回原始文本。
Sub Auto_Open()
Dim q As Integer
'ActiveWorkbook.RefreshAll
'turn off autofilter
ActiveSheet.ListObjects(1).ShowAutoFilter = False
For q = 1 To 18: Worksheets(1).Cells(2, q) = Replace(Worksheets(1).Cells(2, q), "_", " "): Next q
End Sub