Hopefully this helps someone facing this issue. I have had this problem with many sheets I build for clients. So many different users means at least some people don't understand that while editing a cell, you have not actually entered anything. So, I've had to build in different solutions. My favorite three are the following:
1 - I add a checkbox somewhere, and instruct people to check it before saving. The checks if the checkbox is checked, and throws an error message to the user if not. Once it is, the script runs and clears the checkbox.
2 - If the cell in question is empty before someone enters something, then I like this one: The script checks if the cell is blank. If it is, it throws an error message, but something fun like, "Looks like you were still editing. All fixed now! You can run the script again." Throwing the error makes them click "dismiss" or "ok" and this completes the edit on the cell they were editing, so on the next run, it will be fine.
3 - In some cases, it proves better to automate the script on edits. The onEdit script checks if the target cell was modified, and then runs only if it was. So, people don't need to click buttons anymore, it just runs when it's ready.
Another option you could consider is to have the button appear only when the cell has been edited. But that is a bit more "active" than I usually want a script to be.
Bottom line though, this is an unfortunate problem, but after years of writing scripts, I have never found a clean solution to just force the completion of the edited cell before running the script.
EDIT: I should've added, you can use the msgBox trick as part of the script as well. You can pop-up the msgBox and only continue the script after the user clicks "ok" or whatever button you add. You can just add some text there like, "Ready to run, click ok to continue" or something similar ;)
flush()
, and then proceed with your function? – Stodge