Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I Delete Lines from VBA Array?
Quiz,
Why bother? If you loop through them and test the value, just write the valid ones to the text file. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Quizarate" wrote in message ... I have an array in VBA with about 10,000 lines of data, which I am writing to a text file. I can do this with no problem. However, before I write the array to the text file, I want to delete lines that have certain values in them. An example of the code I am playing with is he For i = UBound(ForecastDataArray, 1) To 1 Step -1 If ForecastDataArray(i, 4) = "0000000" Then ForecastDataArray.row(i).Delete End If Next i I know this won't work, but I wanted to give people an idea of what I am trying to do. If 0000000 is found in row i, column 4, then I want to delete the entire row from my array. I know I could write the array to Excel, do my search there, delete the lines out, then save the sheet as a text file, but in the future, the array is going to have well over 200,000 lines in it, so I won't be able to write it to excel. Any help or suggestions are appreciated. TIA, Quiz |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I Delete Lines from VBA Array?
Hello Bob,
I tried using your idea, but it takes a really long time to process my data using that method. I don't know why, but but a process that took a little over 1 minute without testing the data now takes over 10 minutes. It seemed to me that it would be faster to go through the array. Thanks for the response though. John -----Original Message----- Quiz, Why bother? If you loop through them and test the value, just write the valid ones to the text file. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Quizarate" wrote in message ... I have an array in VBA with about 10,000 lines of data, which I am writing to a text file. I can do this with no problem. However, before I write the array to the text file, I want to delete lines that have certain values in them. An example of the code I am playing with is he For i = UBound(ForecastDataArray, 1) To 1 Step - 1 If ForecastDataArray(i, 4) = "0000000" Then ForecastDataArray.row(i).Delete End If Next i I know this won't work, but I wanted to give people an idea of what I am trying to do. If 0000000 is found in row i, column 4, then I want to delete the entire row from my array. I know I could write the array to Excel, do my search there, delete the lines out, then save the sheet as a text file, but in the future, the array is going to have well over 200,000 lines in it, so I won't be able to write it to excel. Any help or suggestions are appreciated. TIA, Quiz . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete Blank Lines | Excel Discussion (Misc queries) | |||
How to delete unwanted lines | Excel Discussion (Misc queries) | |||
Delete Blank Lines | Excel Discussion (Misc queries) | |||
delete grid lines | Excel Worksheet Functions | |||
Delete Blank Lines | Excel Discussion (Misc queries) |