我希望检查 D 到 O 列中的所有单元格。如果单元格为空,则用一个硬零替换它。
我有以下代码:
Sub replace()
Dim rng As Range, cell As Range
Dim aantalrijen As Long
With Worksheets("Schaduwblad")
aantalrijen = .Range("A1", .Range("A1").End(xlDown)).Cells.Count - 1
Set rng = .Range(.Cells(2, "D"), .Cells(aantalrijen, "O"))
For Each cell In rng
cell = WorksheetFunction.Substitute(cell, "", "0")
Next
End With
End Sub
这段代码在处理过程中卡住了。唯一的选择是通过按下Escape键来结束程序。