In my search so far, this is probably the most closely aligned to my current problem: VBA - Index / Match function with multiple criteria
My workbook consists of:
Sample Target Sheet e.g. 1 of 6
I am currently using an INDEX MATCH to return the value I want, but it is painstakingly slow and impractical.
Formula:
=IFERROR(INDEX('Master Sheet'!$A:$H,MATCH(1,('Master Sheet'!$D:$D=E$3)('Master Sheet'!$F:$F=$C6)('Master Sheet'!$A:$A=E$2)('Master Sheet'!$C:$C=E$1)('Master Sheet'!$G:$G=E$4),0),8),"")
I have attempted to translate this into VBA, and while it runs, it doesn't return anything. I also need to add in a loop so it cycles through the columns, and when complete, moves on to the next sheet.
Loop example where the first sheet I want it to look at is number 3:
For i = 3 To Sheets.Count
stream = Sheets(i).Name
Worksheets(stream).Activate
The full code I have:
Sub PopulateWithNewMasterSheet()
Dim row As Long
Dim k As Long
k = 2
With Sheets("Sheet1").Range("B:AV")
For row = 6 To .Rows.Count
If .Cells(1, "E").Value Like Sheets("Master Sheet").Cells(k, "C") And .Cells(2, "E").Value Like Sheets("Master Sheet").Cells(k, "A") And .Cells(3, "E").Value Like Sheets("Master Sheet").Cells(k, "D") And .Cells(4, "E").Value Like Sheets("Master Sheet").Cells(k, "G") And .Cells(row, "C").Value Like Sheets("Master Sheet").Cells(k, "F") Then
'This is a match!
.Cells(row, "E") = Sheets("Master Sheet").Cells(k, "H")
End If
Next
End With
End Sub