Simple Array Looping
I have a macro written to open a .csv file, process, and close it, but I'm
having trouble figuring out how to loop through a list I define that will give each of the document names to open. I could read in a list from a .txt or even define the list manually in VB, but I'm not sure how to "tell" the loop to pick an item in the array, then define that number as a variable that I can enter in my command to open the document, then (after closing) run the next item in the array. The array contents resemble {769290163 6017502167 5621119573 ...} The document names resemble 769290163.csv |
Simple Array Looping
For i = LBound(myArray) To UBound(myArray) filename = myarray(i) 'rest of code Next i -- HTH RP (remove nothere from the email address if mailing direct) "Nikky" wrote in message ... I have a macro written to open a .csv file, process, and close it, but I'm having trouble figuring out how to loop through a list I define that will give each of the document names to open. I could read in a list from a ..txt or even define the list manually in VB, but I'm not sure how to "tell" the loop to pick an item in the array, then define that number as a variable that I can enter in my command to open the document, then (after closing) run the next item in the array. The array contents resemble {769290163 6017502167 5621119573 ...} The document names resemble 769290163.csv |
Simple Array Looping
Thanks, this was dead on.
"Bob Phillips" wrote: For i = LBound(myArray) To UBound(myArray) filename = myarray(i) 'rest of code Next i -- HTH RP (remove nothere from the email address if mailing direct) "Nikky" wrote in message ... I have a macro written to open a .csv file, process, and close it, but I'm having trouble figuring out how to loop through a list I define that will give each of the document names to open. I could read in a list from a ..txt or even define the list manually in VB, but I'm not sure how to "tell" the loop to pick an item in the array, then define that number as a variable that I can enter in my command to open the document, then (after closing) run the next item in the array. The array contents resemble {769290163 6017502167 5621119573 ...} The document names resemble 769290163.csv |
All times are GMT +1. The time now is 10:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com