Thank you very much for your answer, Sir.
But unfortunatelly that is not what i want. Its deleted my old/prev data in my sheet2 (MainINV).
All I want is that if I create a new data in sheet 1 (INV), and push that button. it will check the Invoice number first, If that number exist in MainINV, it will inform the user that the invoice number is exist (already in use before-it recorded as old or prev data in sheet 2 (MainINV). But if that Invoice number is not existed in MainINV (sheet2), Data will be recorded in MainINV Table under my old data, its not deleted or replace my old/prev data.
I can do that if every data is only a single line, just like in this sample files.
But in my case, on my prev post, I have multiple line of data to be recorded, for example in the Description column at sheet1 (INV). So i have to use this kind of code:
Code:
For i = 1 To INV.Range("A5:D14").Rows.Count
If INV.Cells(i + 4, 1).Text <> "" Then
MINV.Range("C" & i + 2).Value = INV.Range("A" & i + 4).Value
End If
If MINV.Range("C" & i + 2).Text <> "" Then
MINV.Range("B" & i + 2).Value = INV.Range("D2").Value
End If
Next i
But unfortunatelly when i use that code, i cant make the new data recorded under my old data in sheet2. My New data use the same position with my old data and replaced it. Its not what i want. I want to keep my old data, and when the new data comes its recorded under my old data, not deleted or replaced my old data. Thank you.