Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在单元格 O12 或 R12 中有文本“投资收入”,我想知道 vba 代码是什么来确定文本是在列 O 还是列 R?
任何帮助将不胜感激。
这是一个非常基本的方法。它不会检查值是否在两个单元格中:
If InStr(Range("O12").Value, "Investment Income") Then MsgBox "It's in O12" ElseIf InStr(Range("R12").Value, "Investment Income") Then MsgBox "It's in R12" Else MsgBox "It's not in either of them." End If