Hello,
I'll try to explain this as best as I can - In a Sheet labeled "Background Info" I have a list in column A, I would like my code to go through each cell in the list in column A and 1. Go to a sheet labeled "Contact Information", perform an advanced filter on the information, copy the lines that fit the criteria (for example, if we are using cell A2 from the list on the "Background Info" sheet, the advanced filter should filter out all the lines that don't match cell A2), then copy the matching lines back to the "Background Info" sheet. The macro should then find the 2nd instance of cell A2 and paste the copied lines 3 rows down.
Then I need to the macro to do pretty much the same thing in another sheet with different information.
Here is the code I have so far:
Dim cell As Range
Sheets("Background Info").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
For Each cell In Selection
Dim rFind As Range
Set rFind = Cells.Find(What:=cell.Value, After:=Sheets("Background Info").Range("A1"), LookIn:=xlValues _
, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
Set rFind = Cells.FindNext(rFind).Offset(3, 0)
Sheets("Contact Information").Columns("A:B").AdvancedFilter Action:=xlFilterCopy _
, CriteriaRange:=cell.Value, CopyToRange:=Sheets("Background Info").Range(rFind), Unique _
:=True
End If
Set rFind = Cells.Find(What:=cell.Value, After:=Sheets("Background Info").Range("A1"), LookIn:=xlValues _
, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
Set rFind = Cells.FindNext(rFind).Offset(3, 2)
Sheets("Purchaser Information").Columns("A:B").AdvancedFilter Action:=xlFilterCopy _
, CriteriaRange:=cell.Value, CopyToRange:=Sheets("Background Info").Range(rFind), Unique _
:=True
End If
Next cell
End Sub
I realize this must be very confusing to someone that is just getting in to the issue, so any help that I can get, I'd really appreciate it. Also, please let me know if you need anything clarified.
Thank you in advance!
Bookmarks