I'm just starting to dabble with VBA and may be in over my head as I really haven't programmed in a decade.
I have already written a macro that allows a user to point to a text file and bring it excel. These text files are the output of a modeling program we use at my workplace. What comes in is pasted in A1 and because the text file is space delimited the data all resides in Column A. What I need to do is have the macro go through this mass of text; find certain tables and copy and paste them to another sheet where they can be delimited into useable data. The tables have variable numbers of rows but a fixed number of columns (i.e. Table R2 will always have 2 columns and Table R3 will always have 4 columns in these output tables).
The macro needs to be able to scan the worksheet find Table R2 and copy out data beneath it. There will be a breakline of no data between each of the tables, but ideally the macro would find "Table R2" and then find "Table R3" and copy the data between them.
Example:
Table R1
Header1 Header2 Header3
A 2 3 15
B 3 6 12
C 4 7 20
D 8 5 18
Table R2
Header1 Header2
E 11 2
F 5 16
G 8 9
Table R3
Header1 Header2 Header3 Header 4
E 11 1 45 16
F 5 16 3 71
G 8 9 25 56
H 2 14 31 33
I 51 16 72 83
Any pointers would be much appreciated.
I have already written a macro that allows a user to point to a text file and bring it excel. These text files are the output of a modeling program we use at my workplace. What comes in is pasted in A1 and because the text file is space delimited the data all resides in Column A. What I need to do is have the macro go through this mass of text; find certain tables and copy and paste them to another sheet where they can be delimited into useable data. The tables have variable numbers of rows but a fixed number of columns (i.e. Table R2 will always have 2 columns and Table R3 will always have 4 columns in these output tables).
The macro needs to be able to scan the worksheet find Table R2 and copy out data beneath it. There will be a breakline of no data between each of the tables, but ideally the macro would find "Table R2" and then find "Table R3" and copy the data between them.
Example:
Table R1
Header1 Header2 Header3
A 2 3 15
B 3 6 12
C 4 7 20
D 8 5 18
Table R2
Header1 Header2
E 11 2
F 5 16
G 8 9
Table R3
Header1 Header2 Header3 Header 4
E 11 1 45 16
F 5 16 3 71
G 8 9 25 56
H 2 14 31 33
I 51 16 72 83
Any pointers would be much appreciated.