In theory the code should work. Reality says otherwise....Do you know what is wrong? Please check out the workbook.
Sub Zero_Escrow_Check()
'write a for loop that checks for a zero balance and a MsgBox or another sheet if the balance isn't zero
Dim neloans As Worksheet
Set neloans = ThisWorkbook.Worksheets("Sheet1")
Dim neloans_last_row As Long
Dim Cell As Range
Dim rng2 As Range
neloans_last_row = neloans.Cells(neloans.Rows.Count, "A").End(xlUp).Row
Set rng2 = neloans.Range("$B$2:$B" & neloans_last_row) 'p153 in big book check out....why?
Dim counter As Long
'change cell to something else
neloans.Range("Q1").Value = 0
neloans.Range("R1").Value = "=Q1 = B11"
counter = 2
For Each Cell In rng2
If Cell.Value = 0 Then
MsgBox "Non-Zero Balance on G" & counter & "counter " & Cell & "cell"
Cell.Value = counter
neloans.Range("C" & counter).Value = 5
End If
counter = counter + 1
Next Cell
'Fix later
'With rng2.SpecialCells(2, 1) 'what does this do?
' Set c = .Find(0, lookat:=xlWhole) 'what?
' If Not c Is Nothing Then
' FirstAdd = c.Address 'returns of addressed of found cell
' Do
' MsgBox "Non-Zero Balance on " & c.Address
' Set c = .FindNext(c)
' Loop While Not c Is Nothing And c.Address <> FirstAdd
' End If
'End With
End Sub
Bookmarks