I have a column with zeros, non-zero numbers, and strings. I need to determine the row number that the last non-zero number is in. This previous thread provided a good example, but it wasn't quite what I was looking for. http://www.excelforum.com/excel-prog...ero-value.html
Here is the code that thread suggested:
The biggest problem is that the "*" returns the last of EVERYTHING that is not a zero, including strings, which is what I don't want. It should only be the last non-zero number. It's also been a while since I had to program in VBA, so I'm also not entirely sure how to set the row number as a variable using these commands.
I have no attachment to the above code, so it can be completely scrapped in favor of something else. Thanks in advance.
Here is the code that thread suggested:
Code:
Sub NonZeroCell()
Dim rRng As Range, rFound As Range
Set rRng = Range("B1", Cells(Rows.Count, "B").End(xlUp))
Set rFound = rRng(rRng.Rows.Count, rRng.Columns.Count)
Do Until rFound > 0
Set rFound = rRng.Find(What:="*", After:=rFound, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
Loop
MsgBox rFound.Address
End Sub
I have no attachment to the above code, so it can be completely scrapped in favor of something else. Thanks in advance.