最好什么search工作表.. EXCEL VBA用户表单

可能重复:
find基于值的单元格位置,然后做一些事情 – 用户窗体VBA Excel

我正在build立一个用户表单,并试图如何编写一段代码:

*从用户获取combobox的值。 *在特定的表格上,在特定的列中search此值*获取此值的单元格位置*返回一个办公室设置地址的行,下一个城市的偏移行“

我之前也问过同样的问题,但是在某种程度上,答案无济于事。

这是我的代码,我想出了:

For Each cLoc In ORISheetList.Range("ORI_LIST") 'compare the input string from list- considering using Match function for this If StrComp(cLoc, ORIValue, vbTextCompare) Then TextBAgencyName.Value = "test" Else: Next cLoc End If 

为每个循环,如果条件不真的在一起工作。

我读过有一个在VBBA Excel的查找function。 有没有一种方法来获取细胞的位置? 谢谢

使用

 Set cLoc = ORISheetList.Range("ORI_LIST").find ORIValue If not cLoc is nothing then ' you found it!