Hi all,
I'm faced with an interesting data validation challenge from my manager, the typical (manual) process would be to compare 2 workbooks comparing ID numbers, and if the information in another column has changed.
If there was a change it would be copied to another workbook (I know 3 books ><) to follow up at a later point.
When my manager walked me through the process I straight away thought this could be simplified but I started the code, and well I got stuck.
So to elaborate on my goal in more detail the things I want to happen are:
One of my attempts is below.
I know the code is very rough, but I think one of my biggest challenges is I am currently learning several code languages at the same time so I mix terminologies.
Any help would be greatly appreciated.
I'm faced with an interesting data validation challenge from my manager, the typical (manual) process would be to compare 2 workbooks comparing ID numbers, and if the information in another column has changed.
If there was a change it would be copied to another workbook (I know 3 books ><) to follow up at a later point.
When my manager walked me through the process I straight away thought this could be simplified but I started the code, and well I got stuck.
So to elaborate on my goal in more detail the things I want to happen are:
- Find duplicated in column B
- If duplicate, then compare the values (of the same row) in column J (is it the same key information across the row)
- I'm unsure if a 3rd verification step is required at this point
- If the data has changed, copy/paste the row with and without changes to secondary sheet
One of my attempts is below.
VBA Code:
Sub Find_changes ()
Dim eventID As Range
Dim subtype As Range
Dim cell As Range
Dim LastRow As Long
Dim Reader As Worksheet
Dim Writer As Worksheet
Set Reader = ThisWorkbook.Worksheets(2)
Set Writer = ThisWorkbook.Worksheets(3)
Set eventID = Range("a:a")
Set subtype = Range("b:b")
Let LastRow = Writer.Cells.SpecialCells(xlCellTypeLastCell).Row
For Each cell In eventID
If eventID = eventID And subtype <> subtype Then
cell.EntireRow.Copy Destination:=Writer.Range(LastRow)
End If
Next
End Sub
End Sub
I know the code is very rough, but I think one of my biggest challenges is I am currently learning several code languages at the same time so I mix terminologies.
Any help would be greatly appreciated.