With a lot of help from S/O, I was able to get some code to work for a project where I am counting the number of duplicates in a sheet and then pushing an array element at the end that counts how many duplicates there are. See here:
Execution without exception error