I have a column "B" that is populated with a series of numbers of six digits. I am looking for my code to look up the last digit and, depending on the result (0 to 4 or 5 to 9), copy it into a separate spreadsheet. The I have code picks up the last digit on each row in column B but then doesn't paste it into the right sheet:
For r = 1 To endRow
ThisValue = Range("B" & r).Value
LResult = Right(ThisValue, 1)
If LResult = 0 Or 1 Or 2 Or 3 Or 4 Then
Rows(r).Select
Selection.Copy
Sheets("Sheet2").Select
Rows(pasteRowIndex).Select
ActiveSheet.Paste
pasteRowIndex = pasteRowIndex + 1
Sheets("Sheet1").Select
Else
Rows(r).Select
Selection.Copy
Sheets("Sheet3").Select
Rows(pasteRowIndex).Select
ActiveSheet.Paste
pasteRowIndex = pasteRowIndex + 1
Sheets("Sheet1").Select
End If
Next r