Hi,
When you use this statement :
the values of Arr variable is "a copy" values of range A1:S5, not the range object itself (for example if you try run this statement: Debug.Print Arr.Address, will raise an error, because Arr is not a range object, but "a copy" values of the range)
So after above statement, the values of Arr are :
So this statement :
is completely error, the parameter for the .cells() is numbers which point to row and column of target cell, so it must be something like :
.Cells(5, 1)
.Cells(2, 3)
etc
but you try to put :
.Cells(Arr(I, 2))
which is :
.Cells("Emp No-1")
so this is error, you don't provide two numeric values, which are the row number and the column number
You previously have made a copy of source range to Arr variable, so it is not needed to retrieve the values from the source range anymore (using .cells() or .range()), but use the Arr instead.
The values that need to returned is a small part of the big array, so I make a smaller array (named ArrPart) to get the needed values using this code:
and then put this ArrPart to target range.
Regards
Bookmarks