现在在写EXCEL中的VB代码,返回EXCEL中某一个单元格对应的行号和列号的函数是什么,
答案:1 悬赏:20 手机版
解决时间 2021-01-20 00:50
- 提问者网友:容嬷嬷拿针来
- 2021-01-19 03:56
现在在写EXCEL中的VB代码,返回EXCEL中某一个单元格对应的行号和列号的函数是什么,
最佳答案
- 五星知识达人网友:撞了怀
- 2021-01-19 04:11
下面是一个实例,在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
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯