如何获取相邻单元格的地址? [英] How to get address of adjacent cell?
本文介绍了如何获取相邻单元格的地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下vba代码在以下列中查找出现的0:
I have the following vba code to find occurrences of "0" in a following column:
For Each c In Range("B:B")
If c.Value = "0" Then
MsgBox "0 found at " & (c.Address)
End If
Next c
如何修改代码,所以当它发现一个0的时候,B6,它显示C7?即。
How can I modify the code so that when it finds a "0" at say, B6, it displays C7? ie. it display the cell diagonally adjacent to the one where the "0" is found.
推荐答案
如何:
MsgBox "0 found at " & Cells(c.Row + 1, c.Column + 1)
这篇关于如何获取相邻单元格的地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文