microsoft_excel:macro_count_sequentially
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
microsoft_excel:macro_count_sequentially [2020/07/15 09:30] – external edit 127.0.0.1 | microsoft_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, | ||
- | If oArrWithCrit(lRow, | ||
- | ArrayCountIfSequential = ArrayCountIf + 1 | ||
- | End If | ||
- | Next | ||
- | End Function | ||
- | </ | ||
- | |||
- | or | ||
- | |||
- | <code excel> | ||
- | ' | ||
- | Function RangeCountIf(oRngWithCrit As Range, vCrit As Variant) | ||
- | Dim vArr1 As Variant | ||
- | Dim lRow As Long | ||
- | | ||
- | vArr1 = oRngWithCrit.Value | ||
- | For lRow = LBound(vArr1, | ||
- | If vArr1(lRow, 1) = vCrit Then | ||
- | RangeCountIf = RangeCountIf + 1 | ||
- | End If | ||
- | Next | ||
- | | ||
- | | ||
- | ' Clear all objects. | ||
- | Set vArr1 = Nothing | ||
- | |||
- | End Function | ||
- | </ | ||
microsoft_excel/macro_count_sequentially.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1