Can anyone tell me how I can make this code work? The first IF statement always works, but the second one never copies the data to the other sheet. Any help is appreciated!
Sub CopyData()
Dim i As Long
For i = 2 To 5000 'change numbers to the range of rows you are checking
If Range("g" & i) = "ACME DISTRIBUTION" Then
Range("g" & i).EntireRow.Copy _
Destination:=Sheets("Acme Distribution").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next
For i = 2 To 5000
If Range("g" & i) = "cycle logistics" Then
Range("g" & i).EntireRow.Copy _
Destination:=Sheets("Cycle Logistics").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next
End Sub
Sub CopyData()
Dim i As Long
For i = 2 To 5000 'change numbers to the range of rows you are checking
If Range("g" & i) = "ACME DISTRIBUTION" Then
Range("g" & i).EntireRow.Copy _
Destination:=Sheets("Acme Distribution").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next
For i = 2 To 5000
If Range("g" & i) = "cycle logistics" Then
Range("g" & i).EntireRow.Copy _
Destination:=Sheets("Cycle Logistics").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next
End Sub