Here is my VBA
Function CellColour(Irow As Integer, Icol As Integer) As Long
CellColour = Cells(Irow, Icol).Interior.ColorIndex
End Function
The color of the grey cells I am using is, -4142
I found this by =CellColour(5,11)
I currently have Two rows that contain monthly Sales data, Once the month ends I manually color the row gray, ""-4142"
I have a section for totals D6 which is a sum of a few cells D6 = Sum(D9:D12)
What I want to accomplish is inside the D6 cell... subtract this gray number.
Cell D6 Formula:
Sum(D9:D12)-If(Cellcolour *IN ROWS F11:Q12* = *GRAY "-4142)
End result SUM D9:D12 MINUS WHATEVER NUMBERS ARE GRAY FROM ROWS F11:Q12
I think my problem lies within my inability to create the proper formula.
I feel like just doing conditional formatting might be easier?
Any help would be awesome.
Thanks!
'
in front of the numbers to convert them to text and hence excluding them from the sum – Slai