envisioning
New Member
- Joined
- May 2, 2011
- Messages
- 13
I have a report that is over 600 pages long.
I am able to remove the junk and afterwards, import it into excel via Text to Column.
The problem is that when the ancient database (an Old DOS one) dumps the data into text, whatever the search field is (example: CABLES), if there is more than one listing for each Cable, the search field is not listed again.
Here is a picture:
As you can see, Cable is listed once, and the Raleways and other fields are continued down until they are done, and then there is a blank row followed by the next CABLE. I need the CABLE ID in ever row it exists, so sorting by CABLE CODE will work correctly (otherwise, sorting throws the empties to the bottom of the list)
My thinking is, is there any way to do a VBA macro to do following??:
1) find a non-blank field (in column A)
2) copy that field (this would be A2)
3) check to see if next row is blank (A3)
4) if true, see if next row is blank (now we are at A4)
5) if true, paste field into A3, if false, restart process by finding next NON-BLANK row
6) select A4
7) check to see if blank
8) if true, check to see if next row is blank (A5)
9) if true, paste A2 value in A4
10) if false, restart process
This would be repeated over and over for the whole large document.
Basically, if there are two blank rows in a row, the Cable ID above the blank rows needs to be pasted in the first blank row.
Whenever there is a situation where there is one blank row only (data exists in the second row), this process needs to start over with the new CABLE ID.
Is this possible or am I completely out of my element? I have been messing with some code but can not seem to figure how to write it so it can do it automatically.
Thanks in advance.
I am able to remove the junk and afterwards, import it into excel via Text to Column.
The problem is that when the ancient database (an Old DOS one) dumps the data into text, whatever the search field is (example: CABLES), if there is more than one listing for each Cable, the search field is not listed again.
Here is a picture:
As you can see, Cable is listed once, and the Raleways and other fields are continued down until they are done, and then there is a blank row followed by the next CABLE. I need the CABLE ID in ever row it exists, so sorting by CABLE CODE will work correctly (otherwise, sorting throws the empties to the bottom of the list)
My thinking is, is there any way to do a VBA macro to do following??:
1) find a non-blank field (in column A)
2) copy that field (this would be A2)
3) check to see if next row is blank (A3)
4) if true, see if next row is blank (now we are at A4)
5) if true, paste field into A3, if false, restart process by finding next NON-BLANK row
6) select A4
7) check to see if blank
8) if true, check to see if next row is blank (A5)
9) if true, paste A2 value in A4
10) if false, restart process
This would be repeated over and over for the whole large document.
Basically, if there are two blank rows in a row, the Cable ID above the blank rows needs to be pasted in the first blank row.
Whenever there is a situation where there is one blank row only (data exists in the second row), this process needs to start over with the new CABLE ID.
Is this possible or am I completely out of my element? I have been messing with some code but can not seem to figure how to write it so it can do it automatically.
Thanks in advance.