here is my code
Sub D_Extract()
x = 1
y = 2
'Find Last Row in Column A
lr = Sheets("sheet1").Cells(Rows.Count, "J").End(xlUp).Row
MsgBox lr
'Extracts Product Code / Description / Lot# / Charge Code
Do Until x = lr
Do Until Left(Sheets("sheet1").Cells(x, 11), 1) = "Q"
x = x + 1
Loop
pcode = (Sheets("sheet1").Cells(x, 3))
desc = (Sheets("sheet1").Cells(x, 4))
lot# = (Sheets("sheet1").Cells(x + 1, 9))
chcode = (Sheets("sheet1").Cells(x, 11))
'Paste Extracted Data in "Data" Sheet
Sheets("data").Cells(y, 1) = pcode
Sheets("data").Cells(y, 2) = desc
Sheets("data").Cells(y, 3) = lot#
Sheets("data").Cells(y, 4) = chcode
x = x + 1
y = y + 1
Loop
End Sub
The code works perfect, but times out once it gets to 65,536.
But why isnt it stopping at the value of lr( last row )?? which is 2202 rows??
I have lr defined, and do until x=lr, but still dont work.
Ideas?
Sub D_Extract()
x = 1
y = 2
'Find Last Row in Column A
lr = Sheets("sheet1").Cells(Rows.Count, "J").End(xlUp).Row
MsgBox lr
'Extracts Product Code / Description / Lot# / Charge Code
Do Until x = lr
Do Until Left(Sheets("sheet1").Cells(x, 11), 1) = "Q"
x = x + 1
Loop
pcode = (Sheets("sheet1").Cells(x, 3))
desc = (Sheets("sheet1").Cells(x, 4))
lot# = (Sheets("sheet1").Cells(x + 1, 9))
chcode = (Sheets("sheet1").Cells(x, 11))
'Paste Extracted Data in "Data" Sheet
Sheets("data").Cells(y, 1) = pcode
Sheets("data").Cells(y, 2) = desc
Sheets("data").Cells(y, 3) = lot#
Sheets("data").Cells(y, 4) = chcode
x = x + 1
y = y + 1
Loop
End Sub
The code works perfect, but times out once it gets to 65,536.
But why isnt it stopping at the value of lr( last row )?? which is 2202 rows??
I have lr defined, and do until x=lr, but still dont work.
Ideas?