I was trying to call sql query from a macro and getting division by zero error. The same macro works when i run a small query. The query is huge and has multiple select statements. I have included 'Set Arithabort On' and 'Set Arithabort off in my SQL query. The macro is generating headers from the SQL table but not the data when i am using CopyFromRecordset to spreadsheet. Please let me know if you need more information. I was trying to call sql query from a macro and