I have been using a useful VB script that goes through a spreadsheet row by row, checks for duplicate cells in that row, deletes all the duplicates and shuffles all the cells along so there are no blanks.
It looks like this:
Do Until ActiveCell = ""
For Each Cell In Selection
If WorksheetFunction.CountIf(Selection, Cell) > 1 Then
On Error Resume Next
However, I now need to perform the same operation, only on a CSV file that has 48,051 columns and therefore wont load in excel due to its 16,000 column limit.
Can I run the script from the command line on the file?
How could I go about doing this?
You could load chunks of the .csv at a time, putting a prefix or suffix at the end of each import. Run VBA code on each chunk, then add back together.
Unfortunately the Workbooks.OpenText method supports importing text starting at a particular row, not a particular column, so you'd need to break up the .csv file into manageable chunks outside of excel, before running VBA code.