Hi all

I'm running a macro in Excel 2010 that filters unique values, does v lookups and simple calculations then pastes a table from a temporary sheet into a permanent sheet. I am repeating this process 14 times in total. However, it will only work for a maximum of two iterations before I get the error above. It appears to be at paste values that it breaks.


Sheets("temp_for_calcs").Columns("a:i").Copy
tables_sheet.Select
Cells(1, table_column).Select
Selection.PasteSpecial xlPasteValues 'copy and paste values to tables <<<<<<<<<<<< breaks here
Call ClearClipboard

p = p + 3 ' loop variables change to account for previous table when pasting
flag_column = flag_column + 3
table_column = table_column + 10

Application.DisplayAlerts = False ' turns off warning about deleting sheets
temp_for_calcs.Delete 'delete temp for calcs so cell refs are the same for the next DMA table
Application.DisplayAlerts = True
any insight into how I can fix this?

thanks a lot