Two solutions to this problem can be found at https://learn.microsoft.com/en-us/answers/questions/5600456/excel-vba-strange-runtime-error-6-overflow?page=1&orderby=Helpful&comment=answer-12314719&translated=false#newest-answer-comment. The simplest is to add right after the Debug.Print statement:
DoEvents ' Force UI refresh