Will from London
Board Regular
- Joined
- Oct 14, 2004
- Messages
- 220
Hi
On an Excel worksheet I have a 10 row by 2 column table which has « copy from path and filename» in column A and « copy to path and filename» in column B. The files in column A exist but the code creates the files listed in column B. The macro works down the list of files, (tab delimited .txt files) reads in each row of the text file, performs a small amount of manipulation and then writes each line to the new file as a comma delimited .txt file.
The substantive parts of the code are (I can’t paste the whole code as I’d be breaching my firm’s IT rules) and speechmarks show up as « « on this keyboard / language layout):
Dim tempStr as String
Open « file from column A » For Input as #1
Open « file from column B » For Output as #2
Do Until EOF(1) = True
Line Input #1, tempStr
...use tempStr = Replace(tempStr, « X », « Y ») Three times for different « X » and « Y »
Print #2, tempStr
Loop
Close #1
Close #2
The text files are up to 70,000 rows in length with no more than about 200 characters per row.
On my old PC (Windows 7, 32bit Excel 2013) it took about 5 minutes to do the whole thing but with the new PC it cannot even complete the list. I have found that if I just process one file at a time and restart the PC between each file then it can process all of them but that does not seem to be efficient. Is there something that gets « clogged up » in the way of RAM or other cache that I can clear between files that will mean that I won’t need to restart the PC so often?
My PC is a 64bit Windows 10 (Enterprise LTSC) (Intel i7-8700T 2.40GHz) running Excel (Microsoft Office Professional Plus 2019) with 16GB of RAM.
Any help gratefully received.
Will
On an Excel worksheet I have a 10 row by 2 column table which has « copy from path and filename» in column A and « copy to path and filename» in column B. The files in column A exist but the code creates the files listed in column B. The macro works down the list of files, (tab delimited .txt files) reads in each row of the text file, performs a small amount of manipulation and then writes each line to the new file as a comma delimited .txt file.
The substantive parts of the code are (I can’t paste the whole code as I’d be breaching my firm’s IT rules) and speechmarks show up as « « on this keyboard / language layout):
Dim tempStr as String
Open « file from column A » For Input as #1
Open « file from column B » For Output as #2
Do Until EOF(1) = True
Line Input #1, tempStr
...use tempStr = Replace(tempStr, « X », « Y ») Three times for different « X » and « Y »
Print #2, tempStr
Loop
Close #1
Close #2
The text files are up to 70,000 rows in length with no more than about 200 characters per row.
On my old PC (Windows 7, 32bit Excel 2013) it took about 5 minutes to do the whole thing but with the new PC it cannot even complete the list. I have found that if I just process one file at a time and restart the PC between each file then it can process all of them but that does not seem to be efficient. Is there something that gets « clogged up » in the way of RAM or other cache that I can clear between files that will mean that I won’t need to restart the PC so often?
My PC is a 64bit Windows 10 (Enterprise LTSC) (Intel i7-8700T 2.40GHz) running Excel (Microsoft Office Professional Plus 2019) with 16GB of RAM.
Any help gratefully received.
Will