AutoCalculate on Custom Function

Oscargriz

New Member
Joined
Oct 22, 2008
Messages
14
I have downloaded a bit of code that would sum a range based on the background color. The "Sum" portion of the function works on change now that I added "Application.Volatile" to the top of the code, however if I change the color of a cell, it doesn't recalculate.

I considered doing a Change Event, however I'm not sure how I need to reference the background color as the item that is changing. Any help here would be appreciated.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,812
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Changing the background colour of a cell does not trigger any events you can trap, which is the main reason I always advise against this sort of setup. It's much better to have the contents of the cell (or another cell) as an indicator and use that to colour the cells. Your functions can then work directly off the cell contents.
 

Oscargriz

New Member
Joined
Oct 22, 2008
Messages
14
Would it be possible then to loop the formula so that any time a new cell is made active, the formula recalculates?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,812
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You could make the SelectionChange event of the worksheet issue a Calculate command, if you really want to stick with this method.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,384
Messages
5,836,946
Members
430,464
Latest member
nickburrett

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top