hi - I'm currently working on a simple macro in an Excel workbook. The main part of the macro pulls in data from a SQL stored procedure and formats it into a Master worksheet. I am now trying to extract data from this Master sheet and append it to other worksheets that are broken out by office location. I need to find rows that have a certain indicator in Column D - this denotes which office location the data belongs to. Once the macro finds a row of data with the correct office location, it needs to compare the row ID (column A) to the row columns of the office worksheet - if the row ID already exists, nothing happens. If the row ID does NOT exist, then the row must be copied from the Master sheet into the Office sheet.

In a nutshell: I need to loop through entries in the Master sheet based on a value in a certain column. For all entries that match my value, I need to compare each entry to another worksheet to see if the entry already exists. If it does, no changes, if it does not, copy the row and paste it into the worksheet (it is not deleted from the Master sheet).

Here is what I have so far (in this example, "10" is the office location ID):

Sub UpdateDivisionsSyr()
'Update division worksheets with new data (do NOT delete old)
Dim rowIDM As Range, rowIDS As Range, i As Integer
Dim Master, DivisionSyr


Set Master = Worksheets("Master")
Set DivisionSyr = Worksheets("SYR")



For Each rowIDM In Master.Range(Master.Range("A:A"), Master.Cells(Rows.Count, 1).End(xlUp)).Cells


i = 1
If Cells(i, 4).Value = "10" And Not IsEmpty(Cells(i, 1).Value) Then

Set rowIDS = DivisionSyr.Range(DivisionSyr.Range("A:A"), _
DivisionSyr.Cells(Rows.Count, 1).End(xlUp)).Find( _
What:=rowIDM.Value, lookat:=xlWhole)


If rowIDS Is Nothing Then
DivisionSyr.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 3).Value = _
rowIDM.Resize(1, 3).Value
End If
End If
Next rowIDM

End Sub