Hi mjr veverka,
I'm running this code from within MS Access since my Access code exports data to an Excel sheet and then manipulates the Excel sheet (i.e. formatting, coloring, etc.). But this all happens from within the MS Access database VBA.
I modified your code slightly to update the column number as well as to account for Access not recognizing the "Application.Clean" command. But I get an error on the line with "If Right$(RTrim$(tbl(r, 1)), Len(crt2)) = crt2 Then" it highlights "tbl" with error "Compile Error ByVal Argument Type Mismatch".
Here's the code:
Error Happens at this line:
This allows the use of the "Clean" feature.
Modified code you provided:
The code runs flawlessly in Excel VBA, just not from the MS Access VBA side. I guess I could pass the code to Excel and execute this from within Excel, but I'll have to research that.
Any thoughts?
Bookmarks