I thought I was finished with my project but ran into a snag when the data is missing. I have several scripts that run as macros in an excel spreadsheet. They are done in steps. Step 1 I take a bunch of .dat files in the same folder and create .xlsx files with the text to columns to separate the data into columns. I also add a couple of blank worksheets to each of the newly created excel workbooks. The .dat files contain about 7,000 rows of data and I only need 1 row that matches my criteria. Step 2, I extract the data that matches my criteria and put them in the new worksheets. I couldn't figure out how to do the search/extract with 2 values....so I search using 1 value and put in the first new worksheet, then I search that new worksheet and extract the one row using the last criteria/value. I may post that code to see if anyone can help me fine tune that. Anyway, in Step 3, the final step, I copy the row of data from the worksheets and insert into a new workbook. All of this works fine, except on occasion there will be no data. The monitor may be offline or whatever the reason, there will be no data for that time period.
Here's what the info will look like during my current runs. You will notice that there is no data and no row listed for 6:00
Example_1.png
I would like to insert an If Else statement so that if there is an empty row of data in the source worksheet then the text "missing data" will be inserted into the copy worksheet. So that the final workbook/worksheet will look like this.
Example_2.png
Here's my code. Note. I do try stuff I find on the internet and in this forum to try to help me solve my issue before I post my request for help. The people in this forum have been very helpful in getting me to my near completion of this project - it's for a non-profit, so your assistance is much appreciated. Thanks!
Please Login or Register to view this content.
Bookmarks