Suppose you want to add cells on the basis of font color. Snapshot below-
Here is the function-
Function sum_colored_font_values(x As Range, su As Range)
Dim Y As Range
Dim sm1 As Long
For Each Y In su
If Y.Font.Color = x.Font.Color Then
sm1 = sm1 + Y.Value
End If
Next Y
sum_colored_font_values = sm1
End Function
type like sum_colored_font_values(f9,$A$2:$A$23)
"$A$2:$A$23" - is a range in which you have to sum the cell values .
"f9" - is a cell having font color
the function will return the sum of values in a range passed who are having the font color same as of "f9"
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
If you want to copy the data from pdf file to Excel. Sub method1_using_sendkey() Dim task ' open the file ' change the path of ...
-
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
No comments:
Post a Comment