从InStr函数返回True/False布尔值?vba [英] Return a True/False Boolean from an InStr function? vba

查看:77
本文介绍了从InStr函数返回True/False布尔值?vba的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在其中使用if函数进行循环.如果需要将功能设为包含"*"或不包含"*"的活动单元格,则需要满足此条件.

I'd like to make a loop with an if function in it. The condition for this if funtion needs to be the active cell containing a "*"or not.

-If-like函数不起作用,因为like函数无法识别"*"数字,因为它使用数字来定义字符串的一部分.

-The If - like funtion does not work because the like function does not recognize "*" figures because it uses these to define parts of strings.

  • 我认为将常规功能与InStr函数结合使用是可行的,但是我不确定如何将它们结合起来.

如何从InStr函数返回True/False布尔值?

推荐答案

Do While ActiveCell.Value <>"" 
    If InStr(ActiveCell.Value, "*") Then
        MsgBox("Cell contains at least one '*'")
        Else:
    End if
    ActiveCell.Offset(1,0)
Loop

这篇关于从InStr函数返回True/False布尔值?vba的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆