I'm having a hell of a time with this one. I've managed to automate the file handling portions of this new job for creating a new daily report for my group, but the most annoying step is updating the master files with the new dumps from the FTP.

The unique ID for each file that needs to be compared is in Column 2 (B), I need to walk through each sheets column B and if there IS a match, update columns O-W with the values in the new file, and if the unique ID doesn't exist in the old file to add the entire row at the bottom of the used range of the main file.

This is an amalgam of code i've scrounged/copied and some things I wrote myself, so it's a hot mess I know.
Here's the run down.
1)I receive 4 files daily via FTP, 1 for 4 different states
2)These files are auto-archived and then the newest version of each is renamed to the two letter state name (i.e. IL.csv) and moved to a fresh data folder.
3)I have an intermediate file in a shared network drive that needs to allow for manual data entry from each state daily on actual performance that I need to auto-merge any updated values or new rows of data into from the files in step 2
4)I already have a query and cleanup run that merges the 4 intermediate files from step 4 into the master workbook that I can auto-generate my reports from.
The part that's killing me is figuring out how to read from the daily files, evaluate against the intermediate files and update certain columns if changed and add any new rows (the previous day's activity).
I definitely know that my select copy isn't accurate or working below, but I can't even get the upper portion to open and select from the files to work correctly, I keep getting "object doesn't support this property or method" on OldRange and NewRange.
Sub UpdateDataWithNew()

Dim ILmain As Workbook
Dim ILnew As Workbook
Dim data As Worksheet
Dim maintable As Worksheet
Dim OldRange AsInteger
Dim NewRange AsInteger
Dim ListOld As Range
Dim ListNew As Range
Dim x As Range
Dim y As Range


Workbooks
.Open Filename:="C:\Users\adeno\Desktop\Test Load
Files\Illinois.xlsm"

Workbooks
.Open Filename:="C:\Users\adeno\Desktop\Today's FTP\IL.csv"
Set ILmain = Workbooks("Illinois.xlsm")
Set ILnew = Workbooks("IL.csv")
OldRange
= ILmain.Range("A2",
Worksheets
("Sheet1").Range("A2").End(xlDown)).Rows.Count
NewRange
= ILnew.Range("A2",
Worksheets
("Sheet1").Range("A2").End(xlDown)).Rows.Count

Set ListOld = Range("B2:B"& OldRange)
Set ListNew = Range("B2:B"& NewRange)

Set data = ILnew.Sheets("Sheet1")
Set maintable = ILmain.Sheets("Sheet1")


ForEach x In ListOld
Workbook
.ILnew.Activate
If Application.CountIf(ListB, x)=0Then
Row
.Copy
Workbook
.ILmain.Activate
Row
.End(x1Up).Select