Results 1 to 4 of 4

Getting a MsgBox for non-Zero Balances

Threaded View

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    84

    Getting a MsgBox for non-Zero Balances

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. LIFO Balances and P&L
    By ccop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2015, 06:04 PM
  2. Macro to capture MsgBox prompt to a string variable but ignore the MsgBox
    By BuglerDobbs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2015, 10:56 AM
  3. [SOLVED] Problem with VBA Editor uses lower case on some lines (ex. msgbox instead of MsgBox)
    By stubbsj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2013, 06:59 PM
  4. [SOLVED] Choose from different balances in VBA
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-01-2012, 03:32 PM
  5. How to sum balances that have same SSN/EIN???
    By jgomez in forum Excel General
    Replies: 2
    Last Post: 01-25-2012, 12:13 PM
  6. Running Balances
    By Sal in forum Excel General
    Replies: 3
    Last Post: 07-11-2006, 04:32 PM
  7. Showing zero balances
    By Ed in forum Excel General
    Replies: 2
    Last Post: 08-09-2005, 02:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1