[英]Macro to execute only if range of cells all contain the word “OK”
As the title states, I need a macro that can only be executed if a range of cells all contain the word "OK". 如标题所示,我需要一个仅在一系列单元格都包含单词“ OK”的情况下才能执行的宏。 This is based off of a formula, that checks that certain criteria are met before I can push an order through to another sheet in the same workbook. 这基于一个公式,该公式在我可以将订单推送到同一工作簿中的另一张表之前,先检查是否满足某些条件。 I have a Macro for that already, all I need is to setup the criteria validation that will check the cell range, make sure all cells within range say "OK", run the Macro if it checks out, otherwise, prompt a message box saying the Order is not correct as entered. 我已经有了一个宏,我需要做的是设置条件验证以检查单元格范围,确保范围内的所有单元格都说“确定”,如果签出,则运行宏,否则,提示信息框订单输入不正确。
In two steps might be simplest: 分两个步骤可能是最简单的:
=COUNTIF(E5:J5,"OK")
somewhere in your worksheet, say K5 (adjust formula to suit), then 如果是连续范围,请说出E5:J5,其中第5行是相关的,在工作表中的某处添加=COUNTIF(E5:J5,"OK")
,说出K5(调整公式以适合),然后
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.