Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

how auto update vba script in excel ?

$
0
0

Hi people,

 i have a VBA script inside a Module

Function SumColor(rColor As Range, rSumRange As Range)

 Dim rCell As Range
 Dim iCol As Integer
 Dim vResult
 
 Application.Volatile
 
 'iCol = rColor.Interior.ColorIndex
 iCol = rColor.Font.Color

 For Each rCell In rSumRange
'If rCell.Interior.ColorIndex = iCol Then
 If rCell.Font.Color = iCol Then
 vResult = WorksheetFunction.Sum(rCell) + vResult
 End If
 Next rCell

 SumColor = vResult
End Function

how can simply sum cell if they are the same font.color that a reference cell

but when i'm changing a cell the VBA dont auto-update the result and i have to push F9 to make it happen...

so is there anyway to auto refresh the vba (on timer or on mouse event (click) )

thx a lot people.



Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>