Reputation: 3914
Is there a way to copy certain columns from 1 array into 1 range. My problem is that not only the first few columns I want to omit, which should be easy, but also one column in the middle. However I need that column in the middle to validate against. Is there an easy way to skip that column when copying a row from the array into a worksheet? Or is the only way around to make that column the first or the last column when building the array?
The code I have until now is:
For row1 = 2 To TotalRowsMerged
For row = 2 To TotalRowsAgron
If Cells(row1, 1) = Agron_Array(row, 1) And Cells(row1, 2) = Agron_Array(row, 2) Then
Range(Cells(row1,11).Address,Cells(row1,23).Address) = Agron_Array(row,
The columns that I need are: 5 to 13 and 15 to 18, so in total 13, which is the same size as my range.
Upvotes: 0
Views: 1666
Reputation: 34085
You can use Index
with an array of column indices:
Range(Cells(row1,11).Address,Cells(row1,23).Address) = _
Application.Index(Agron_Array, row, Array(5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18))
Upvotes: 1