vendredi 11 septembre 2015

Check if an argument is a certain array

I have two arrays, which I want to pass as arguments to another Sub:

Public arr1 As Variant
Public arr2 As Variant

Sub Main()
    arr1 = listSheet.Range("E2:G4").Value
    arr2 = listSheet.Range("H2:J60").Value

    call mySub(arr1)
    call mySub(arr2)
End sub()

In the "other" sub, I need to check which array is passed, but none of the below options is working:

sub mySub(ByRef myArr As Variant)

    if myArr=arr1 Then
    'do actions
    end if
'and I also tried:
    if myArr is arr1 then
    'do actions
    end if
end sub

How can I possibly check this using an IF statement, or is this doable in any other way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire