Results 1 to 5 of 5

Why won't my Do while run?

Threaded View

  1. #1
    Registered User
    Join Date
    02-28-2011
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    6

    Why won't my Do while run?

    i'm trying to create a macro that transfers a set of data from one sheet to another on the condition that the first row has text in it (in my case a name). It's supposed to stop when the first row is out of names starting after row 52 on the first sheet. I'm writing test code to see if it functions correctly but it only runs once. I'm starting the copying at row 52 on the first sheet and then transfering it to a second sheet starting on row 8 and from then on go row by row until sheet 1 is out of text. The first sheet is "Master Input for year."The from. The to is to the "quarterly NPI" Here's the code. Any help is appreciated.
    Sub MakeNPIs()
    
    Dim x As Integer
    Dim a As Integer
    
    Sheets("Master Input for year").Select 'To make sure it starts on the right sheet.
    x = 52
    a = 8
    
    Do While Cells(x, 1).Value <> ""
        
        Sheets("Master Input for year").Select
          Cells(x, 1).Copy
        Sheets("Quarterly NPIs").Select
        Cells(a, 1).PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
        x = x + 1
        a = a + 1
    
    Loop
    End Sub


    It looks right to me. Why won't it work?
    Last edited by Cluv; 03-01-2011 at 11:44 AM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

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