Sum by color using VBA in Microsoft Excel

Sum by color using VBA in Microsoft Excel



In this article we learn to how  Microsoft Excel Sheet can calculate the sum of Cell with specific Color in defined range of Cell.  we create the custom module by using VBA in Microsoft Excel.


Step 1: Open Microsoft Excel where you want to Sum Cell with specific Color in defined range of Cell




Step 2: Using Keyboard press Alt-F11 to Open Microsoft Visual Basic for Applications





Step 3: User right click on "Project - VBAProject (pane)" select insert and click on "Module (menu item)"




Step 4: Copy the following code in Module1 (Code) (window)" and save and Close the Microsoft Visual Basic for Applications







Step 5: Now select Cell where you want sum and type =SumByColor(referenceCell,SelectRange)  

For my Example =SumByColor(E31,H2:H28) 
where I want to add red Color Cell and my reference Cell is E31(Sum of Wrong Entry)




Enjoy....




0 Comments