I'm trying to map certain values from a data list to another worksheet if certain conditions are met. I have done this in the past using arrays but now I am getting a runtime error and I can't debug. The mapping works like this (assuming condition is met): column A to A, B to B, AK to C, AL to D and AM to E.
Sub newcontracts()
Dim source As Variant
Dim destination As Variant
Dim j As Integer
Dim x As Integer
Dim LastRow As Long
source = Array("A", "B", "AK", "AL", "AM")
desitnation = Array("a", "b", "c", "d", "e")
LastRow = ThisWorkbook.Sheets(2).Cells(Rows.Count, 1).End(xlUp).Row
LastRow3 = ThisWorkbook.Sheets("New Contracts").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("New Contracts").Range("A2:i10").ClearContents
With Worksheets(2)
For x = 11312 To LastRow
If (IsEmpty(Cells(x, 39)) = False Or Cells(x, 39) <> 0) And Cells(x, 40) = "no" Then
For j = 0 To 4
.Range(source(j) & x).Copy Sheets("New Contracts").Range(destination(j) & Rows.Count).End(xlUp)(1)
Next j
End If
Next x
End With
End Sub
Thanks a million!