我知道这很容易在 VBA 之外完成,但我想作为初学者精通 VBA。
我有一长列(大约 25,000 行)。我需要在该列中找到第一个单元格值大于零的实例。然后我需要将该单元格的地址返回给一个变量。到目前为止,我一直在使用循环没有成功,有什么建议吗?
最佳答案
您可以轻松地执行以下操作:
For each c in Range("A1:A25000").Cells
If c.Value > 0 Then
firstValue = c.Value
firstAddress = c.Address
Exit For
End If
Next
MsgBox "The first value greater than zero is in cell " & firstAddress & _
"; - it has value " & firstValue
关于vba - 如何在 VBA 的列中找到大于零的第一个值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23475919/