现在在写EXCEL中的VB代码,返回EXCEL中某一个单元格对应的行号和列号的函数是什么,

已经SHEET1中某单元格的内容a1,需要返回该单元格的行号和列号,请问代码如何写啊?

下面是一个实例,在a1:e500里查找“a1” 其中c.Address就是行号和列号的文本格式例如$B$1
c.Column是列号, c.Row是行号

With Sheets("sheet1").Range("a1:e500")
Set c = .Find("a1", LookIn:=xlFormulas)
If Not c Is Nothing Then
firstAddress = c.Address
firstColumn = c.Column
firstRow = c.Row

Do
Set c = .FindNext(c)
nextAddress=c.Address
nextColumn = c.Column
nextRow = c.Row

Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
温馨提示:答案为网友推荐,仅供参考
相似回答