Thank you for the new version.
It's true what you say: the not adjusted residual is the square root of the cell Chi square, but still you should export the table to Excel to perform the easy calculations. Actually this is what I used to do before: with your script it's much faster.
If you want to check one more possible improvement, note that the script does not show the std residuals when either variable contains missing values. I mean: the table with the frequencies is displayed correctly (e.g. without missing values), but the residuals are not displayed at all. I tried to pre-filter the data table in order to avoid any missing values, but it didn't solve the issue.