User Tools

Site Tools


microsoft_excel:macro_count_sequentially

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
microsoft_excel:macro_count_sequentially [2020/07/15 09:30] – external edit 127.0.0.1microsoft_excel:macro_count_sequentially [2021/08/04 14:06] (current) – removed peter
Line 1: Line 1:
-====== Microsoft Excel - Macro Count Sequentially ====== 
- 
-<code excel> 
-' Returns the number of vCrit found within the array oArrWithCrit. 
-Function ArrayCountIfSequential(oArrWithCrit As Variant, vCrit As Variant) 
-    Dim lRow As Long 
-     
-    For lRow = LBound(oArrWithCrit, 1) To UBound(oArrWithCrit, 1) 
-        If oArrWithCrit(lRow, 1) = vCrit Then 
-            ArrayCountIfSequential = ArrayCountIf + 1 
-        End If 
-    Next 
-End Function 
-</code> 
- 
-or 
- 
-<code excel> 
-'=ArrayCountIf(A1:A1000,"Foo",B1:B1000) 
-Function RangeCountIf(oRngWithCrit As Range, vCrit As Variant) 
-    Dim vArr1 As Variant 
-    Dim lRow As Long 
-     
-    vArr1 = oRngWithCrit.Value 
-    For lRow = LBound(vArr1, 1) To UBound(vArr1, 1) 
-        If vArr1(lRow, 1) = vCrit Then 
-            RangeCountIf = RangeCountIf + 1 
-        End If 
-    Next 
-     
-     
-    ' Clear all objects. 
-    Set vArr1 = Nothing 
- 
-End Function 
-</code> 
  
microsoft_excel/macro_count_sequentially.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki