现在在写EXCEL中的VB代码,返回EXCEL中某一个单元格对应的行号和列号的函数是什么,
1个回答
展开全部
下面是一个实例,在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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询