Results 1 to 5 of 5

Do Until Loop not working

Threaded View

  1. #1
    Registered User
    Join Date
    11-12-2015
    Location
    Washington DC
    MS-Off Ver
    2013
    Posts
    34

    Do Until Loop not working

    Here is my code. It is getting errors that I don't understand. It will run through the loop various times and delete a chunk of rows like it's supposed to but then it will thow up different errors. its crazy. It works when I F8 through the whole thing but when I run it it always hits a snag and the debugger sometimes yellows out the "Loop" line and sometimes the "ActiveCell.Offset(-1, 0).Select" line and sometimes the "Cells(Rows.Count, 9).End(xlUp).Select" Line. I don't understand what is wrong with any of the code. It worked perfectly yesterday but I changed the query that is the source data and the test column is the 9th column and not the 11th. Any help would be appreciated. I have a data sheet with 1500 records for 7 different accounts and I want to write this code to make a separate worksheet for each account.
    Sub CashCashEq()
    
    ActiveSheet.Copy After:=Worksheets(Worksheets.Count)
    
    Cells(Rows.Count, 9).End(xlUp).Select
    
    Do Until ActiveCell.Row = 1
    
    If ActiveCell.Value <> 111595 Or ActiveCell.Offset(0, -1).Value <> 10 Then ActiveCell.EntireRow.Delete
    ActiveCell.Offset(-1, 0).Select
    
    Loop
    
    End Sub
    Last edited by wellen72; 06-08-2016 at 04:02 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. For Next Loop not Working
    By basmster in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-01-2016, 01:11 PM
  2. [SOLVED] Do Until Loop Not Working
    By jjl287 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-30-2015, 04:49 PM
  3. For loop within loop not working correctly
    By HalPlz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2015, 12:06 AM
  4. [SOLVED] For Next Loop not working
    By jacob@thepenpoint in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2013, 02:24 PM
  5. Loop not working...
    By yunesm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2011, 08:12 AM
  6. [SOLVED] Why is this Do Loop not working right?
    By evilrtc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-21-2007, 01:52 AM
  7. Do...Loop not working
    By Sunny Lin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2005, 09:06 PM

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