VBA Problem - Copying Rows Based on Specific Text and Pasting to New Worksheet


New Member
Dec 17, 2014
Hi All,

This problem seems really simple in theory, but I'm very new to VBA so I've been trying to use past suggestions to similar problems and work from there but haven't been able to get very far.

Basically, I need a way to identify rows off of a main worksheet called Lockbox 223064 based on specific names that are in column "I" (Omaha is the name used in the code below) . Then I need those entire rows that are copied to be pasted into a new worksheet with a specific name (the name of the worksheet is also called Omaha ​ in the example below).

I have used the following code to get me started towards what I am looking for:

Sub Copy_Paste()
Dim LR As Long, i As Long
With Sheets("Lockbox 223064")
LR = .Range("I" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With .Range("I" & i)
If .Value Like "*Omaha*" Then .EntireRow.Copy Destination:=Sheets("Omaha").Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
Next i
End With
End Sub

- This code will work for me. However, there are multiple names that I need to use to identify rows by (for example besides Omaha, any rows containing Woodmen, GPM Life, or United World Life in column "I" need to be copied to this specific worksheet as well)

If anyone can help me or suggest another way about this I would be greatly appreciative. Someone recommended using an autofilter code to filter by these names and then copy the results. However, I couldn't get the code to copy only the results for some reason.

Thanks in advance
Last edited:

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics