View Single Post
 
Old 12-06-2018, 07:14 PM
Kenneth Hobson Kenneth Hobson is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Jun 2018
Posts: 37
Kenneth Hobson is on a distinguished road
Default

Put this in a Module for the master workbook. Run macro with slave workbook open. Change SlaveIDs.xlsm to your slave workbooks name. Test on backup copies.

Code:
Sub Main()
  Dim s1 As Worksheet, s2 As Worksheet
  Dim r1 As Range, r2 As Range, f2 As Range
  Dim r1e As Range, r2e As Range, c As Range
  
  Set s1 = ThisWorkbook.Worksheets("lfd. & geschlossene Vergleiche")
  'Assumes slaveids.xlsm is open already and first sheet is sheet to modify.
  Set s2 = Workbooks("SlaveIDs.xlsm").Worksheets(1)
  
  Set r1e = s1.Cells(Rows.Count, "B").End(xlUp)
  Set r1 = s1.Range("B112", r1e)
  Set r2e = s2.Cells(Rows.Count, "A").End(xlUp)
  Set r2 = s2.Range("A112", r2e)
  
  For Each c In r1.Cells
    Set f2 = r2.Find(c.Value, r2e, xlValues, xlWhole, , xlNext, , True)
    If f2 Is Nothing Then GoTo NextC
    s2.Cells(f2.Row, "AP").Value = s1.Cells(c.Row, "AN").Value & vbLf & _
      "settlement not reached " & vbLf & s1.Cells(c.Row, "AH").Value
    f2.Cells(f2.Row, "AZ").Value = "closed: settlement"
NextC:
  Next c
End Sub
Reply With Quote