答案1
此代码将完成如下描述的工作:
Option Explicit
Sub fillEmptyCellsWithZero()
Dim oSheet As Worksheet
Dim oRange As Range, oRow As Range, aCells As Range, oCell As Range
Dim countEmptyCell As Integer
Set oSheet = ActiveSheet
Set oRange = Application.Intersect(oSheet.UsedRange, oSheet.Range("A:C"))
For Each oRow In oRange.Rows
countEmptyCell = Application.WorksheetFunction.CountBlank(oRow)
If (countEmptyCell > 0) And (countEmptyCell < 3) Then
Set aCells = oRow.SpecialCells(xlCellTypeBlanks)
For Each oCell In aCells.Cells
oCell.Value = 0
Next oCell
End If
Next oRow
End Sub
但出于某种原因,我认为你将无法使用它:任务描述显然是故意简化的,与你的真实数据不符 -XY问题