如何从Excel函数中获取单元格地址

我有一个问题,如何获得单元格地址使用查找function。 这是代码

Dim Found As Range Set Found = Worksheets("Sheet 1").Cells.Find(What:="test", LookAt:=xlWhole, MatchCase:=True) If Not Found Is Nothing Then ' do something End If 

问题是当我尝试debugging代码时,“Found”variables包含一个“string”而不是单元格地址。

不知道我的代码有什么问题。

看来你可以使用found.address即使它显示为string。 下面的代码为我工作。

 Sub findCellAddress() Dim ra As Range Set ra = Cells.Find(What:="fff", LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False) If ra Is Nothing Then MsgBox ("Not found") Else MsgBox (ra.Address) End If End Sub