I created an array which is populated if a condition is met - so far so good. Now the values which met the condition need to be copied to a different sheet.
Actually I have to questions: 1. I can't get the values in the range in the first place.; 2. The array stores 4 columns (range) for each row if the criteria is met. Would it be possible if I can determine each array column and paste it in a specific column (in the array the columns are next to each other, but in the destination sheet they are not).
This the code I have so far:
Sub determineDelta()
'Start determination and copy values to Delta sheet
Worksheets("Source").Activate
Range("A2").Select
numberOfRecords = Range(Selection, Selection.End(xlDown)).Rows.Count + 1
Dim myArray() As Variant
ReDim myArray(1 To 500) As Variant
Dim i, j, k As Integer
k = 0
ReDim myArray(numberOfRecords, k) As Variant
For i = 2 To numberOfRecords
If IsError(Application.Match(Cells(i, "A").Value, Sheets("SE16N").Range("A:A"), 0)) Then
For j = 2 To 6
myArray(j, k) = Cells(i, j).Value
Debug.Print myArray(j, k)
Next j
k = k + 1
ReDim Preserve myArray(numberOfRecords, k)
End If
Next i
Worksheets("Delta").Activate
Range("I2:I" & UBound(myArray)) = "FI"
Range("J2:J" & UBound(myArray)) = "A"
Range("M2").Resize(UBound(myArray), 1).Value = Application.Transpose(myArray)
End Sub
I've been looking on the internet for 2 days, including cpearson. In this article about array sizing (on the bottom) it states #N/A. This is what I do have! But don't want. :-)
I have the feeling I'm not that far off and wouldn't be surprised if it is just something relatively small.
I hope someone can help me.