As per the original poster, @Geoff Mulhall, watching the spreadsheet while the code ran revealed the background color flashing on and off. This helped them find the problematic line of code and realize the issue was with their own logic.
Note: Posting this as a Community Wiki so others in the community know that the posted code itself isn't wrong, but the issue lies with its own logic.