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?
Bookmarks