to all
Looking at different ideas about searching through a range of cells for the value in the 1st column of an array (array is Nrow*10columns)
Sort of vlookup() or match() if you like. Nothing new/hasn't been done before . Used List of() in the past (or was it a Dictionary ?) as can use
bur I am very rusty with all this. Maybe turning the s1t column of the array into a
might be faster
A few steps are broken down as a 1st pass (easier for me) but I suspect one can merge a few line eg setting range
Looking at different ideas about searching through a range of cells for the value in the 1st column of an array (array is Nrow*10columns)
Sort of vlookup() or match() if you like. Nothing new/hasn't been done before . Used List of() in the past (or was it a Dictionary ?) as can use
VBA Code:
.Exist
VBA Code:
Collection
A few steps are broken down as a 1st pass (easier for me) but I suspect one can merge a few line eg setting range
VBA Code:
im myarray As Variant ' this is a Nrow * 10column
'myarray = rgfull.Value 'to be added at some point
Dim wktarget As Worksheet: Set wktarget = Worksheets("target")
Dim irowtarget As Integer: irowtarget = 2
Dim icoltarget As Integer: icoltarget = 2
Dim rgID As Range
With wktarget
'Worksheets("target").Range(Cells(irowtarget, icoltarget)).Select ' this is not working
.Range("B2").Select
'.Range(Selection, Selection.End(xlDown)).Select
Set rgID = .Range(Selection, Selection.End(xlDown))
End With
For Each c In rgID
For ii = 0 To UBound(myarray)
'find the row in the array matching the value of cell being processed
'if found it then copy the data in the array row ii to the targetsheet
If myarray(ii, 0) <> c.Value Then
GoTo Skiptonext
Else
'past row ii, column 1 to 9 to cell(.Activecell.row,3)
datafromarray = myarray(ii,1:ii,9) <---syntax required!!
wktarget.Range(c.Address.Row, 3).Value = datafromarray
End If
Skiptonext:
Next
Next c