Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Ooieoey iienea aoaee?o?ueo yeaiaioia a n?aco 2 eieiieao. Aoaeeeaoii
- 'n?eoaaony niaiaaaiea cia?aiee n?aco a 2 eieiieao (ia?ana?aiea iii?anoa)
- 'noaiaa?oiay yenaeaaneay ooieoey COUNTIF ia ?aaioaao ni no?ieaie aieuoa 256 neiaieia (
- 'Ooieoe? iaaicii?ii eniieuciaaou iiaoi?ii. Ia?aienaou
- Public Function CountDuplicates2(rngRange1 As Range, rngRange2 As Range) As Integer
- Dim wsCur As Worksheet
- Dim CallerRange As Range
- Dim CallerCol, CallerRow As Integer
- Dim rngCol1, rngCol2 As Integer
- Dim CheckCell1, CheckCell2 As String
- Dim theCell As String 'Current test value
- Dim iRow As Integer
- Set CallerRange = Application.caller
- CallerCol = CallerRange.Column 'Maybe none required
- CallerRow = CallerRange.row
- rngCol1 = rngRange1.Cells(1, 1).Column
- rngCol2 = rngRange2.Cells(1, 1).Column
- CountDuplicates2 = 1 ' API FIX
- If wsCur Is Nothing Then
- Set wsCur = ThisWorkbook.Application.caller.Worksheet
- End If
- CheckCell1 = wsCur.Cells(CallerRow, rngCol1).Value
- CheckCell2 = wsCur.Cells(CallerRow, rngCol2).Value
- If CheckCell1 = "" Then
- 'Return operator simulation
- GoTo EndFunction
- End If
- If CheckCell2 = "" Then
- 'Return operator simulation
- GoTo EndFunction
- End If
- 'FIXME: Remove hardcode. Use Model, Luke
- For iRow = 4 To (4 + rngRange1.Rows.Count) - 1
- If iRow = CallerRow Then
- 'Continue operator simulation
- GoTo Continue_iRow
- End If
- theCell = wsCur.Cells(iRow, rngCol1).Value
- If theCell <> CheckCell1 Then
- 'Current Cell is not equals test value
- 'Continue operator simulation
- GoTo Continue_iRow
- End If
- theCell = wsCur.Cells(iRow, rngCol2).Value
- If theCell <> CheckCell2 Then
- 'Current Cell is not equals test value
- 'Continue operator simulation
- GoTo Continue_iRow
- End If
- 'All checks passed
- CountDuplicates2 = CountDuplicates2 + 1
- Continue_iRow:
- Next iRow
- EndFunction:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement