Relative Content

Tag Archive for arraysexcelvbatxt

Subscript out of Range error when writing an array from a txt file into a spreadsheet

I have a function within an Excel spreadsheet that pulls data from a fixed width txt file and pastes it into a spreadsheet. The function currently stores each set of data into an array and pastes it in row by row. However, I am getting go a point where the txt file has 90,000 rows in it and the processing time has increased for the macro. I was trying to optimize the macro so that instead of going row by row, it stores all the data into an array and pastes it in all at once to reduce the amount of times the macro calls to the worksheet. Here is the original code: