I'm really stuck on this one. I have an error that consistently repeats, and I'm not sure how to keep it from happening. I'm not so sure it's anything with the code, but rather something with the way Excel runs.
The file that contains this error is attached. In a nutshell, the program creates a graphical time schedule by selecting a persons name. It does this by searching through a database of information and copying every instance that is associated with that name. The code then selects the block of time through a range of cells, merges the cells, and pastes the course information in the cells. You simply choose another name to create a schedule for someone else (and the program in-between unmerges and clears the cells, etc.). The user can then click on any empty cell to fill it in as another type of hour (office, online, etc.). When you open the file it opens to a page with instructions on how to use it. It works perfectly every single time with the exception of one specific name. To create this error, simply go to the "Graphical Schedule" tab, choose the name 'Douglas Mabry' and click "Create Schedule". I would recommend you choose a couple of other names first to see how the software works. Once you've chosen the name that gives the error, you'll see that the error is a #REF error in the total hours areas. These errors are being carried over from another worksheet called "Office Hours", and although I hide this sheet typically I left it visible so it would be easily found. There are several other worksheets that can be "unhidden" if needed.
The "Office Hours" worksheet is the sheet that tallies the total hours other than classes (such as the above-mentioned office, online and so-on). Thus it directly references the cells on the "Graphical Schedule" worksheet. Now... as mentioned before, some of the cells on the "Graphical Schedule" worksheet get merged, and I could see where this might throw a #REF error (for instance, if cells A14:A17 are merged and a formula was referencing A16, would that throw a #REF error?). However, this doesn't happen with any other name you choose, and they reference cells that are "merged away". So why do I get the #REF error for this user?
Would the easiest thing be to create some type of error handling? Right now, if that name is chosen, the #REF errors are there to stay. You have to close and reopen the spreadsheet to be able to create schedules for another user (assuming you didn't save the file with the #REF error, in which case you're really stuck).
NOTE--the worksheets automatically password protect themselves to keep someone from accidentally overwriting formulas. I also protect the workbook. The password to unprotect any of the sheets, VBA code, etc., is 5,4,3,2,1 (just the numbers... no commas).
Bookmarks