I'm trying to find a solution to automatically recalculate a VBA formula once I change the color of the cell
Function SumColorColumns11(sumRange As Range) As Double
Dim cell As Range
For Each cell In sumRange
If cell.Interior.Color = 12611584 And cell.Column = 7 Then
SumColorColumns11 = SumColorColumns11 + 20
ElseIf cell.Interior.Color = 12611584 And cell.Column = 8 Then
SumColorColumns11 = SumColorColumns11 + 30
End If
Next cell
SumColorColumns11 = SumColorColumns11 / 100
Currently when I want to recalculate the VBA formula I go to a cell that has the formula and click on the then formula then press enter.
After editing it
Function SumColorColumns11(sumRange As Range) As Double
Dim cell As Range
For Each cell In sumRange
If cell.Interior.Color = 12611584 And cell.Column = 7 Then
SumColorColumns11 = SumColorColumns11 + 20
ElseIf cell.Interior.Color = 12611584 And cell.Column = 8 Then
SumColorColumns11 = SumColorColumns11 + 30
cell.Calculate
End If
Next cell
SumColorColumns11 = SumColorColumns11 / 100
I have found other solution to Run a Macro when a User Changes, but I don't know how to apply it on my function as it receive an range and return a value.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("C6:R393")) Is Nothing Then
MsgBox "hi"
End If
End Sub
ActiveSheet.Calculateshould force calculation on a page to update - Marcucciboy2