Sub Macro1()
'
' Macro1 Macro
' Macro recorded 1/17/2009 by Roy Weil
'
numCompanyRows = 150
numProductionRow = 460
'
Sheets("Company_Listings").Select
For iirow = 1 To numCompanyRows
producer = Range("I" & iirow).Value ' get the producer
Sheets("Production_Listings").Select
For jjrow = 1 To numProductionRow
If match(producer, Range("d" & jjrow).Value) Then
saveRow (jjrow)
ElseIf match(producer, Range("E" & jjrow).Value) Then
saveRow (jjrow)
ElseIf match(producer, Range("F" & jjrow).Value) Then
saveRow (jjrow)
End If
Next
Next
End Sub
Function match(aa, bb)
If (aa = bb) Then
match = True
Else
match = False
End If
End Function
Sub saveRow(jj)
Sheets("Cross-Reference").Select
For iirow = 1 To 1000 ' find the next empty row
If (Range("A" & iirow).Value = "") Then
newrow = iirow & ":" & iirow
Exit For
End If
Next
Sheets("Production_Listings").Select 'get data to copy
temp = jj & ":" & jj
Range(temp).Select
Selection.Copy
Sheets("Cross-Reference").Select
Range(newrow).Select
ActiveSheet.Paste
End Sub
|