#REF error when processing COUNTIFs formula

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
I have this spreadsheet which combines the contents of six different spreadsheets in a specified location. The way it runs is that I have an Auto_Open routine on Sheet 1 to combine them once I open this spreadsheet.

Where I'm having trouble at is that in Sheet 2 of this spreadsheet, I have a table to set up to run a COUNTIFS formula based on two different sets of criteria. The formula works great when the spreadsheet is open. But once I close the spreadsheet and reopen it, it sets the values to "#REF" because the contents of the spreadsheet are deleted and rebuilt when I open it again. Is there anyway to get around this?

I'll provide more information if needed.
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,487
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Don't delete the cells, just clear them.
 

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
I did try this, but by not deleting the rows, its adding more rows below the contents each time the macro is run.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,487
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It's pretty hard for me to comment about a macro I can't see. ;)
 

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
I may just add a routine that deletes the cells that do not contain data after all the other routines have ran and all the spreadsheets have been combined.
What code would enable me to do that?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,487
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Perhaps you could post what you have and we could see about fixing it?
 

Watch MrExcel Video

Forum statistics

Threads
1,108,614
Messages
5,523,902
Members
409,542
Latest member
Shezz01

This Week's Hot Topics

Top