I have two text files attached below and having some parameters in those. I would like to store these parameters from each text file in an array in VBA.
Can any body help me on this?
Thanks in advance.
I have two text files attached below and having some parameters in those. I would like to store these parameters from each text file in an array in VBA.
Can any body help me on this?
Thanks in advance.
Last edited by krish T; 10-21-2010 at 11:56 AM. Reason: Solved the problem
Hello krish T,
What will the array dimensions be?
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi Leith Ross,
Array will be like as below:. First it has to open first text file, read the first line and save as Table(1,1) and second line as Table(2,1) and 3rd line as Table(3,1) and 4th line as Table (4,1). Next it has to open second text file and save the 4 lines as Table(1,2), Table(2,2), Table(3,2) and Table(4,2).![]()
Please Login or Register to view this content.
Hello Leith Ross,
Can you answer me for the above problem? Appreciate your help.
Hello krish T,
Based on your previous post, I believe the array dimensions should be Array(1 To 50, 1 to 2), yes?
That's correct Leith Ross based on above example. But actually the second dimension in Array(1 To 50, 1 to 2) may vary like Array(1 To 50, 1 to 3) or Array(1 To 50, 1 to 10). If you can guide me based on above example, I will try to change it to my required dimension in the array. Thanks for your reply.
Krish T
Any help will appreciate on above problem.
Thanks in advance.
Hello krish T,
I have been having problems with my computer today. What will determine the size of the second dimension in the array, i.e. Array(1 To 50, 1 To 10), Array(1 To 50, 1 to 20)?
Hello Leith Ross,
I will give brief description about my problem. I have some parameters in the xls sheet which will be given by me or an user like p1,p2...etc. So I have written the code to count these parameters. So my second dimension in the array is this count and I will be having text files in a folder equal to this count. This count is fixed for a particular case. Please assume my count is 2 for time being means second dimension in the array is Array(1 To 50, 1 To 2) i.e, I am having two text files in a folder. Please suggest me based on this example.
Please let me know if you need any other information.
Thanks
Krish T
Hello Krish T,
This macro will store the contents of two files in same directory into an Array(1 To 50, 1 To 2). You will need to add the file path and perhaps change the names of the two text files. We can expand this macro to do more later. Let me know how this works for you.
![]()
Please Login or Register to view this content.
Hi Leith Ross, Sorry for late response. Thanks for you reply and macro. I have modified this macro for my requirement but getting some problem.If I am able to produce FileArray similar to given by you, then my problem will be 95% solved. Can you suggest me on this?![]()
Please Login or Register to view this content.
Its really awesome response from you on this problem.
Thanks
Krish T
Hello Krish T,
I made the changes to load the FileArray.
![]()
Please Login or Register to view this content.
Hi Leith, Thanks for your quick response. Here the above code is giving the problem in the following loop:so I have changed the above code as below and it is working:![]()
Please Login or Register to view this content.
Thanks![]()
Please Login or Register to view this content.
Krish T
You are genius Leith. Solved my problem. Thanks a lot. Really helpful to me.
Thanks
Krish T
Hello Krish T,
Sorry about the oversight on the loop indices. I thought I had changed them. Glad to know it is working.
No problem Leith. Once again Thanks to you.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks