showtyme
09-10-2015, 09:36 AM
I have a huge text file that I import on a monthly basis to Excel but need a macro that would delete rows except for those that has data between a cell that starts with "----" and ends with a "G/L Total:" in column A. Note that it's exactly 4 hyphens.
Those two elements ("----" and "G/L Total:") are repeated at different rows in column A. Note that there are some blank cells in column A but not in between those two elements. If there are any blank cells in column A then the entire row should also be deleted.
For example, there is extraneous rows of data from A1:A100 which includes blank rows, then A101 will start with "----" and have rows of data say until A120 where the last line will say "G/L Total:" Then in A121 there is extraneous data again until A180 then A181 will start with "----" and have rows of data say until A220, where the last line will say "G/L Total:" So the macro should delete the extraneous data (A1:A100 and A121:A180) including any rows where a cell in column A is empty and only display the data that is between "----" and "G/L Total:" (A101:A120 and A181:A220) for the entire spreadsheet.
Thanks in advance.
Those two elements ("----" and "G/L Total:") are repeated at different rows in column A. Note that there are some blank cells in column A but not in between those two elements. If there are any blank cells in column A then the entire row should also be deleted.
For example, there is extraneous rows of data from A1:A100 which includes blank rows, then A101 will start with "----" and have rows of data say until A120 where the last line will say "G/L Total:" Then in A121 there is extraneous data again until A180 then A181 will start with "----" and have rows of data say until A220, where the last line will say "G/L Total:" So the macro should delete the extraneous data (A1:A100 and A121:A180) including any rows where a cell in column A is empty and only display the data that is between "----" and "G/L Total:" (A101:A120 and A181:A220) for the entire spreadsheet.
Thanks in advance.