Good Morning everyone,
currently im working with a list "test". In this list im searching for keywords and then having it copy over to a specific sheet. The problem im encountering is that it is copying the rows over from bottom to top. not top to bottom. I want it to search for jimmy from top to bottom and copy the rows over as it finds it. I guess right now its searching from bottom to top and copying them but im not sure how to change that.
Sub testing()
If ActiveSheet.Name = "test" Then 'This is saying to run the code if the Daily sheet is active, otherwise msgbox will pop up
Application.ScreenUpdating = False
Sheets("jimmy").Select 'Calling the erase all sub below
activewindow.Zoom = 85
With activewindow
.SplitColumn = 0
.SplitRow = 1
End With
activewindow.FreezePanes = True
Call Sizecolumns
Call eraseAll
Dim wb As Workbook
Dim ws As Worksheet
Dim wsjimmy As Worksheet
Set wb = Application.ThisWorkbook
Set ws = Sheets("test")
Set wsjimmy = Sheets("jimmy")
LastRow = ws.Cells(Rows.Count, "K").End(xlUp).Row
lrjimmy = wsJimmy.Cells(Rows.Count, "K").End(xlUp).Row
With ws
For lng = LastRow To 2 Step -1
If Range("K" & lng).Value = "Jimmy" Or Range("K" & lng) = "JIMMY" Or Range("K" & lng) = "jimmy" Then
Rows(lng).Copy Destination:=wsjimmy.Range("A" & lrjimmy + 1)
lrJose = lrJose + 1
ElseIf Range("K" & lng).Value = "J" Or Range("K" & lng) = "j" Or Range("K" & lng) = "jim" Or Range("K" & lng) = "Jim" Or Range("K" & lng) = "immy" Then
MsgBox "At least one result starting with 'J' was omitted while looking for 'jimmy'" & vbNewLine & "please look for possible typos in Column K"
End If
Next lng
End With
End If
Application.ScreenUpdating = True
MsgBox "Processing Complete."
End Sub
Bookmarks