Not looping copy & paste, find each X, paste to new sheet?
Posted by Joe Was on August 15, 2001 11:12 AM
This code only works for the first test. It tests for a "X" in column "A" if it finds a "X" it copies the whole row and pastes it to a different sheet. It should loop back and find the next "X" but it does not?
A fix or other solution would be much appreciated!
Sub Priority()
'Find all the rows that have a "X" in column "A" copy
'that row to the next blank row on a different sheet.
X = 1
Do
X = X + 1
'Look for row in column "A" that meets test.
Worksheets("Want_Full").Select
If Cells(X, 1) = "X" Then
'Select row that meets test.
Range(Cells(X, 1), Cells(X, 7)).Select
'Copy row that meets test.
Selection.Copy
'Paste to next blank row on different sheet.
Worksheets("Want_Now").Select
Range("A65536").End(xlUp).Select
Worksheets("Want_Now").Paste
Else
End If
'Find all the rows that have "X" in column "A"
'and do the copy & paste from above.
Loop Until Cells(X + 1, 1) = "X"
End Sub