Hi can anyone help me check what's wrong with this code?
Sub copyTodifferentsheet()
Dim i As Integer
Dim Priority As String
Dim Task As Range
i = Sheets(1).Range("A4").Value
Do While i <= Sheets(1).Range("A4").End(xlDown).Value
Set Task = Sheets(1).Range("b3").Offset(i, 2)
Priority = Task.Value
If Priority = "Urgent" Then
Range(Task, Task.Offset(0, 1)).Copy
Sheets(2).Range(Cells(i + 1, 2), Cells(i + 1, 3)).PasteSpecial xlPasteValues
ElseIf Priority = "Important" Then
Range(Task, Task.Offset(0, 1)).Copy
Sheets(3).Range(Cells(i + 1, 2), Cells(i + 1, 3)).PasteSpecial xlPasteValues
ElseIf Priority = "Easy easy" Then
Range(Task, Task.Offset(0, 1)).Copy
Sheets(4).Range(Cells(i + 1, 2), Cells(i + 1, 3)).PasteSpecial xlPasteValues
Else
End If
i = i + 1
Loop
End Sub
Sub copyTodifferentsheet()
Dim i As Integer
Dim Priority As String
Dim Task As Range
i = Sheets(1).Range("A4").Value
Do While i <= Sheets(1).Range("A4").End(xlDown).Value
Set Task = Sheets(1).Range("b3").Offset(i, 2)
Priority = Task.Value
If Priority = "Urgent" Then
Range(Task, Task.Offset(0, 1)).Copy
Sheets(2).Range(Cells(i + 1, 2), Cells(i + 1, 3)).PasteSpecial xlPasteValues
ElseIf Priority = "Important" Then
Range(Task, Task.Offset(0, 1)).Copy
Sheets(3).Range(Cells(i + 1, 2), Cells(i + 1, 3)).PasteSpecial xlPasteValues
ElseIf Priority = "Easy easy" Then
Range(Task, Task.Offset(0, 1)).Copy
Sheets(4).Range(Cells(i + 1, 2), Cells(i + 1, 3)).PasteSpecial xlPasteValues
Else
End If
i = i + 1
Loop
End Sub