我正试图使用下面的代码在一系列单元格中循环,搜索包含
=""
:
Sub ReplaceEmptyCells()
Dim i As String
Dim k As String
Dim cell As Range
i = "=" & Chr(34) & Chr(34)
k = "#N/A"
For Each cell In ActiveSheet.Range("C1:AA51") 'Desired range to search through
If cell.Value = i Then
cell.Replace What:=i, Replacement:=k, MatchCase:=True
End If
Next cell
End Sub
此值已在另一张工作表上手动设置,相关单元格已作为链接复制和粘贴(这样做是为了避免粘贴后空单元格转换为0s,同时保留原始数据中的0s)。
其目的是使新工作表上“空白”单元格的内容为“不适用”。为什么上述子项不起作用?