Hello,
I need a little help as I'm out of my depth right now. My existing code is horrible. It does a Double loop and its copying the Cell every time it doesn't find a match.
Ideally, I want it to take the contents of sh3.Range("A" & iRow) and search sh1.Range("A:A"). If it finds a match, move on. If it doesn't find a match, then
Logic Example of what I'm talking about:
Sheet1 = Master
Sheet3 = New Monthly Data
Here is what I have so far and it doesn't work.
I need a little help as I'm out of my depth right now. My existing code is horrible. It does a Double loop and its copying the Cell every time it doesn't find a match.
Ideally, I want it to take the contents of sh3.Range("A" & iRow) and search sh1.Range("A:A"). If it finds a match, move on. If it doesn't find a match, then
Code:
Cells(iRow, "A").Copy sh1.Range("A" & LastRowx + 1)
Logic Example of what I'm talking about:
Sheet1 = Master
Sheet3 = New Monthly Data
Sheet3'!A180 = NewClientXYZ
Sheet1 has 580 rows of existing Clients and NewClientXYZ is not present.
Add NewClientXYZ to Sheet1'!A581
Continue the process until all New Clients are added to Master sheet.Here is what I have so far and it doesn't work.
Code:
Const xlStrtRw As Long = 9 'Starting row number for the Monthly data.
Dim sh1 As Worksheet 'Master Worksheet
Dim sh3 As Worksheet 'Monthly Report
Dim LastRow As Long
Dim LastRowx As Long
Dim xlRow As Long
Dim iRow As Long
Dim i As Integer
Set sh1 = Sheets("Master")
Set sh3 = Sheets("Client Relations Trending Month")
LastRow = sh1.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
xlRow = sh3.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
For iRow = xlStrtRw To xlRow Step 1 ' Row 9 to LastRow on Monthly data sheet
For i = 2 To LastRow
If sh1.Range("A" & i) <> sh3.Range("A" & iRow) Then
LastRowx = sh1.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row 'Not sure if this is needed but it resets the RowCount on Master sheet for each new client added if match above not found
Cells(iRow, "A").Copy sh1.Range("A" & LastRowx + 1)
End If
Next i
Next iRow
End Sub
Last edited: