PDA

View Full Version : [SOLVED:] Do While Loop will not execute



mars1886
02-11-2014, 07:20 AM
Disregard! I figured it out! Thanks!

I'm unsure as to why the loop won't execute. It goes to the first line of the Do While loop, then instantly goes to End Sub. Any thoughts?



Sub test()Dim i, c, d As Integer
Dim PN, Index As String


i = 1
c = 2
d = 2
PN = Cells(c, 6)
Index = Cells(d, 16)

Do While Cells(c, 6) <> ("") And Cells(d, 16) = ("")
Sheets(CPB).Select

If Cells(c, 6) <> ("") And Cells(d, 16) = ("") Then
Range("A" & c & "P" & d).Select
Selection.Copy
Sheets(PB).Select
ActiveSheet.Paste
i = i + 1
c = c + 1
d = d + 1

ElseIf Cells(c, 6) <> ("") And Cells(d, 16) <> ("") Then
i = i + 1
c = c + 1
d = d + 1

Else
Exit Do
End If
Loop

End Sub