Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Function lngWordsIn(strAr1() As String, strAr2() As String, Optional boolCase As Boolean = True, Optional lngCutOff) As Long
' Procedure :       lngWordsIn
' Description:      determine how many elements of one array apear in the other array.
' Copyright: Chris Greaves Inc.
' Inputs:              Two arrays, case-sensitive switch, cutoff value
' Returns:            LONG number of elements matched
' Assumes:          Nothing
' Side Effects:     None
' Tested:               By the calls shown below.
'    Dim bool As Boolean
'    If IsMissing(boolCase) Then
'        bool = True
'    Else
'        bool = boolCase
'    End If
    Dim lngResult As Long
    lngResult = 0
    lngWordsIn = lngResult
    Dim lng1 As Long
    For lng1 = 1 To UBound(strAr1)
        Dim lng2 As Long
        For lng2 = 1 To UBound(strAr2)
            If boolCase Then
                If strAr1(lng1) = strAr2(lng2) Then
                    lngResult = lngResult + 1
                    lngWordsIn = lngResult
                    Exit For
                Else
                End If
            Else
                If UCase(strAr1(lng1)) = UCase((strAr2(lng2))) Then
                    lngResult = lngResult + 1
                    lngWordsIn = lngResult
                    Exit For
                Else
                End If
            End If
        Next lng2
        If IsMissing(lngCutOff) Then
        Else
            If lngResult >= lngCutOff Then
'                Exit Function
                GoTo MyExit
            Else
            End If
        End If
    Next lng1
MyExit:
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Function lngWordsIn(strAr1() As String, strAr2() As String, Optional boolCase As Boolean = True, Optional lngCutOff) As Long
' Procedure :       lngWordsIn
' Description:      determine how many elements of one array apear in the other array.
' Copyright: Chris Greaves Inc.
' Inputs:              Two arrays, case-sensitive switch, cutoff value
' Returns:            LONG number of elements matched
' Assumes:          Nothing
' Side Effects:     None
' Tested:               By the calls shown below.
'    Dim bool As Boolean
'    If IsMissing(boolCase) Then
'        bool = True
'    Else
'        bool = boolCase
'    End If
    Dim lngResult As Long
    lngResult = 0
    lngWordsIn = lngResult
    Dim lng1 As Long
    For lng1 = 1 To UBound(strAr1)
        Dim lng2 As Long
        For lng2 = 1 To UBound(strAr2)
            If boolCase Then
                If strAr1(lng1) = strAr2(lng2) Then
                    lngResult = lngResult + 1
                    lngWordsIn = lngResult
                    Exit For
                Else
                End If
            Else
                If UCase(strAr1(lng1)) = UCase((strAr2(lng2))) Then
                    lngResult = lngResult + 1
                    lngWordsIn = lngResult
                    Exit For
                Else
                End If
            End If
        Next lng2
        If IsMissing(lngCutOff) Then
        Else
            If lngResult >= lngCutOff Then
'                Exit Function
                GoTo MyExit
            Else
            End If
        End If
    Next lng1
MyExit:
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1