Results 1 to 6 of 6

Do Until Loop Not Working

Threaded View

  1. #1
    Registered User
    Join Date
    05-04-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Do Until Loop Not Working

    Hi All,

    I have a macro that pulls rows from a tab called "Report" to the tab "New Employees" based on the value "NEW" in Column R. It also pulls rows to the tab "Existing Employees" based on the value "Existing" in Column S. Both of these codes work fine when I split them up into two macros, but when I combine them into the code below, only the "New Employees" tab gets populated; the "Existing Employees" tab does not. Can anyone help me figure out why I'm running into this problem? Thanks in advance for your help!
    Sub NewEmployees()
    
    Set i = Sheets("Report")
    Set e = Sheets("New Employees")
    Set f = Sheets("Existing Employees")
    Dim d
    Dim j
    d = 1
    j = 2
    
    Do Until IsEmpty(i.Range("R" & j))
    
    If i.Range("R" & j) = "NEW" Then
    d = d + 1
    e.Rows(d).Value = i.Rows(j).Value
    
    End If
    j = j + 1
    Loop
    
    Do Until IsEmpty(i.Range("S" & j))
    
    If i.Range("S" & j) = "EXISTING" Then
    d = d + 1
    e.Rows(d).Value = i.Rows(j).Value
    
    End If
    j = j + 1
    Loop
    Last edited by Leith Ross; 10-30-2015 at 04:18 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 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
  2. [SOLVED] For each loop not working
    By schzuki in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2014, 09:54 AM
  3. [SOLVED] Do while loop not working
    By rikkyshh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 01:47 PM
  4. Loop not working
    By blankus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2009, 04:16 AM
  5. [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
  6. Loop not working!!
    By Simon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2005, 12:05 PM
  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