Sub Data()
Dim ItemName As Variant
Dim FinalRow As Long
Dim i As Long
ItemName = Sheets("Sheet3").Range("B4").Value
FinalRow = Sheets("Sheet1:Sheet2!B3:B10").Row
For i = 3 To FinalRow
If Cells(i, 2) = ItemName And Cells(i, 4) = "" And Cells(i, 5) = "sheet1" Then
Range(Cells(i, 3)).Copy
Range("B3", Range("B3").End(xlDown)).PasteSpecial Paste:=xlPasteAll, Operation:=xlPasteSpecialOperationAdd, SkipBlanks:=False, Transpose:=False
If Cells(i, 2) = ItemName And Cells(i, 4) = "" And Cells(i, 5) = "sheet2" Then
Range(Cells(i, 3)).Copy
Range("B3", Range("B3").End(xlDown)).PasteSpecial Paste:=xlPasteAll, Operation:=xlPasteSpecialOperationAdd, SkipBlanks:=False, Transpose:=False
ElseIf Cells(i, 2) = ItemName And Cells(i, 3) = "" And Cells(i, 5) = "sheet1" Then
enter code here
Range(Cells(i, 4)).Copy
Range("B3", Range("B3").End(xlDown)).PasteSpecial Paste:=xlPasteAll, _
Operation:=xlPasteSpecialOperationAdd, SkipBlanks:=False, Transpose:=False
Else:
End If
enter code here
ElseIf Cells(i, 2) = ItemName And Cells(i, 3) = "" And Cells(i, 5) = "sheet1" Then
Range(Cells(i, 4)).Copy
Range("B3", Range("B3").End(xlDown)).PasteSpecial Paste:=xlPasteAll, _
Operation:=xlPasteSpecialOperationAdd, SkipBlanks:=False, Transpose:=False
Else:
End If
Next i
End Sub
'''the code does not seems to work any help much appreciated