- If count >0 Then
- Range("A2:A999").ClearContents
- Worksheets("Want List").Select
- i = 9
- Do While Cells(i, 2) <> ""
- i = i + 1
- Loop
- For j = 1 To UBound(Qty)
- If i + j - 1 = 9 Then 'Re-number the Line No column
- Cells(i + j - 1, 1) = 1
- Else
- Cells(i + j - 1, 1) = Cells(i + j - 2, 1) + 1
- End If
- Cells(j + i - 1, 2) = Item_No(j - 1)
- Cells(j + i - 1, 4) = Description(j - 1)
- Cells(j + i - 1, 8) = Qty(j - 1)
- Next j
- End If
The macro appears to run up to line 13 before returning the error. I have had similar problems where a macro will run correctly, but return an error referring to an if statement. I assume the issue is not with the if statement, but within in the coding contained in the if statement.