Hello,
So I have created an array with 2 values in it SEE: KMyarray = Application.Transpose(Range(rngArray1, rngArray2))
In my other variable I have StrLookForString = <code here> (see below).
I want to see if the value in MyArray1 and the value in MyArray2 = StrLookForString .
So basically
MyArray(1) & MyArray(2) = Variable
How do I do this? See some of the code below:
And this is the function which is not working - my guess:
This is what is not working (my guess): If CStr(arr(r, 1)) & CStr(arr(r, 2)) = val Then
Would really appreciate if anyone can help me, I am stuck here.
So I have created an array with 2 values in it SEE: KMyarray = Application.Transpose(Range(rngArray1, rngArray2))
In my other variable I have StrLookForString = <code here> (see below).
I want to see if the value in MyArray1 and the value in MyArray2 = StrLookForString .
So basically
MyArray(1) & MyArray(2) = Variable
How do I do this? See some of the code below:
VBA Code:
Set rngArray1 = Range(Sheets("Köpunderlag").Range("B2"), Sheets("Köpunderlag").Range("B2").End(xlDown))
Set rngArray2 = Range(Sheets("Köpunderlag").Range("G2"), Sheets("Köpunderlag").Range("G2").End(xlDown))
KMyarray = Application.Transpose(Range(rngArray1, rngArray2))
StrLookForString = Sheets("OFIC Köp").Cells(i, 5) & Sheets("OFIC Köp").Cells(i, 12)
BoolHit = FindLoop(KMyarray, StrLookForString)
If BoolHit = True Then
SomeCodeHere
Else
Something else
And this is the function which is not working - my guess:
VBA Code:
Function FindLoop(arr, val) As Boolean
' Function to find matching value in array.
Dim r As Long
For r = 1 To UBound(arr, 1)
If CStr(arr(r, 1)) & CStr(arr(r, 2)) = val Then
FindLoop = True
arr(r, 1) = "OK"
arr(r, 2) = "OK"
Exit Function
End If
Next r
End Function
This is what is not working (my guess): If CStr(arr(r, 1)) & CStr(arr(r, 2)) = val Then
Would really appreciate if anyone can help me, I am stuck here.