The goal here is to compare values in column "A" between two workbooks (the current workbook is .xlsm, the target workbook is .xlsx). If any matches are found; the value in column "E" on the same row of matched value, is changed in the target workbook. It is mandatory to keep the workbooks separate in this case.
I decided to do this by selecting the first value in the current workbook (A2), applying it's value to a variable, then scanning column "A" in the target workbook to find a match (there should always be at least one match). Then changing the value of column "E" in the target workbook to "DSC" for those matched rows. Afterwards the selected cell in the current workbook is moved down one, and loops this process until a blank cell is reached.
Here is the code currently:
Sub DSC()
Dim RowCount As Long
secondWorkbook = "Master.xlsx"
currentWorkbook = ThisWorkbook.Name
Workbooks.Open ThisWorkbook.Path & "\" & secondWorkbook
' Define number of rows
RowCount = Workbooks("Master.xlsx").Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
' Select First Cell
Windows(currentWorkbook).Activate
Worksheets("Update Wipe").Activate
Range("A2").Select
Serial = ActiveCell.Value
Windows(secondWorkbook).Activate
Worksheets("Sheet1").Activate
' Run Function
For c = 2 To (RowCount - 1)
Windows(secondWorkbook).Activate
If Sheet1.Cells(c, 1).Value = Serial Then
Sheet1.Cells(c, 5) = "DSC"
Windows(currentWorkbook).Activate
Worksheets("Update Wipe").Activate
Selection.Offset(1, 0).Select
Serial = ActiveCell.Value
If Serial = "" Then Exit For
End If
Next c
End Sub
At the moment no errors are returned, however nothing is updating in the target workbook. It will open the target workbook on the computer. Bouncing the active workbook and worksheet back and forth to change the selected cell and update the variable may be the cause.