I wrote a function in macro that it doesn't respond well. Description of macro:
I want to find value of a cell by 3 Characters
- Item
- Quality of my item
- Date
I want to write a function that can accept different variable range in any sheet and search those 3 characters to find the value.
My code is here
Function findvalue(x1 As Variant, x2 As Range, x3 As Variant, x4 As Range, x5 As Variant, x6 As Range)
Dim cell As Range
Dim cell2 As Range
Dim cell3 As Range
For Each cell In x2
If x1 = cell.Value Then
For Each cell2 In x4
If x3 = cell2.Value Then
For Each cell3 In x6
If x5 = cell3.Value Then
findvalue = Cells(cell2, cell3)
End If
Next cell3
Exit For
End If
Next cell2
Exit For
End If
Next cell
End Function
Item and quality of item should be in column and date should be in row
I attached my file
Sheet1
has my data and in Sheet2
I want to find my value