假设您有一个产品列表(列A
),旁边有总计。如果您要查找任何总数(列B
)等于零并将LOW
放在其旁边的单元格中(列C
),请执行以下操作:
Set Rng = Range("B1:B16").Find(What:="0", LookAt:=xlWhole, LookIn:=xlValues)
Rng.Offset(, 1).Value = "LOW"
Sub MyOffset()
With Range("B1:B16")
Set Rng = .Find(What:="0", LookAt:=xlWhole, LookIn:=xlValues)
If Not Rng Is Nothing Then
firstAddress = Rng.Address
Do
Rng.Offset(, 1).Value = "LOW"
Set Rng = .FindNext(Rng)
Loop While Not Rng Is Nothing And Rng.Address <> firstAddress
End If
End With
End Sub
答案 0 :(得分:1)
Find()方法在匹配其参数中指定的条件(“What”,“LookIn”,“LookAt”,...)时调用范围内的单元格,并返回找到的单元格引用(如果找不到匹配项,则为Range
对象)或空引用对象(使用关键字Nothing
引用)