我想在其中创建一个包含if函数的循环。这个if iftion的条件必须是包含" *"的活动单元格。
- If-like功能不起作用,因为like功能无法识别" *"因为它使用这些来定义字符串的一部分。
如何从InStr函数返回True / False布尔值?
答案 0 :(得分:2)
Do While ActiveCell.Value <>""
If InStr(ActiveCell.Value, "*") Then
MsgBox("Cell contains at least one "*")
Else:
End if
ActiveCell.Offset(1,0)
Loop
答案 1 :(得分:0)
Do While ActiveCell.Value <> ""
If InStr(ActiveCell.Value, "*") <> 0 Then
MsgBox("Cell contains at least one "*")
Else
MsgBox("Cell does not contain at least one "*")
End if
ActiveCell.Offset(1,0)
Loop
字符串表达式或者包含特殊字符的位置。如果没有,那么Instr返回的值将为0。