ok right now we're not trying to loop through anything so you can't use the asterisk in the set statement. For now just make a new file called myCsvFile.csv in the relevant folder and put exactly what i put in mine, refer back to what i've already posted if you need to:
Code:
'wrong
Set wbCsv = Workbooks.Open("C:\Production2\ATX\Extracts\201001\DealerData\*.csv")
'right
Set wbCsv = Workbooks.Open("C:\Production2\ATX\Extracts\201001\DealerData\myCsvFile.csv")
Also, the varaible lNextRow is a replacement for that "xlUp" stuff you were doing before, it's what finds the next row to put the data into so you don't want it referring across multiple columns. You want it to count the number of rows in ExtractSize.xls that have data already in them, like the comment says, I add two to lNextRow because Counta counts cells that have something in them, and since I have a blank row at the top and we want the next AVAILABLE row, we add 2. Just make a new workbook called ExtractSize and put it in the relevant folder with EXACTLY what i have in mine, refer back to what i've already posted if you need to
Code:
'incorrect
lNextRow = WorksheetFunction.CountA(wsDealerExtracts.Range("F17:H38"))
'correct
lNextRow = WorksheetFunction.CountA(wsDealerExtracts.Range("A:A")) + 2
and lastly, you almost never want to activate a workbook as it only slows things down
Code:
'incorrect
Set wsDealerExtracts = wbExtractSize.Sheets("DealerExtracts").Activate
'correct
Set wsDealerExtracts = wbExtractSize.Sheets("DealerExtracts")
and we'll take it from there.