Need help, new to VB - I'm not sure what is wrong...

Goal: 1. To import a CSV file into the first empty row in the spreadsheet, starting in column G. 2. Then if duplicate rows exists, delete the rows (based on two specific columns). 3. Then, copy the preexisting formula from the above cell.

Script works great the 1-2nd time, not so much the 3rd:

Run Sub 1st time - works; data imports (starting at G & at first empty row in worksheet) = good
Run Sub again - works; imports data (G & first empty row), deletes duplicate data = good
Run Sub again - Does not work; inserts a new column at G (or moves all exists data to the right), then imports that data starting a G & first empty = Not good.

I'm not sure what is causing the existing data (including the header) to be shifted one column to the right.

Note: I can run the copy/import all day long, by itself, and no issues (it keeps on copy/importing the data start at G & at the first empty row). I've only been able to narrow the issue down to at the QueryTables.Add and before the delete duplicates.


Please Login or Register  to view this content.