A
Arran
To all,
I have the following code that is working well and copies information from 1
sheet to another, but what I want to change it slightly so that if the value
in DBWks.Cells(MLRow, 3) matches that in NewFormWks.Cells(7, 4) a message box
pops up and stats that the record is duplicated. if this is the case the sub
should be exited.
Can anyone help??
MLRow = 4 'MasterList Start Row
Do Until ThisWorkbook.Sheets("Data Base").Cells(MLRow, 3) = ""
If DBWks.Cells(MLRow, 3).Value = NewFormWks.Cells(7, 4).Value Then
DBWks.Cells(MLRow, 2).Value = NewFormWks.Cells(5, 7).Value 'Division
DBWks.Cells(MLRow, 3).Value = NewFormWks.Cells(7, 4).Value 'Contract
No
DBWks.Cells(MLRow, 4).Value = NewFormWks.Cells(7, 7).Value 'Branch
MLRow = 5
Exit Do
End If
MLRow = MLRow + 1
If DBWks.Cells(MLRow, 3).Value = "" Then
DBWks.Cells(MLRow, 2).Value = NewFormWks.Cells(5, 7).Value 'Division
DBWks.Cells(MLRow, 3).Value = NewFormWks.Cells(7, 4).Value
'Contract No
DBWks.Cells(MLRow, 4).Value = NewFormWks.Cells(7, 7).Value 'Branch
End If
Loop
I have the following code that is working well and copies information from 1
sheet to another, but what I want to change it slightly so that if the value
in DBWks.Cells(MLRow, 3) matches that in NewFormWks.Cells(7, 4) a message box
pops up and stats that the record is duplicated. if this is the case the sub
should be exited.
Can anyone help??
MLRow = 4 'MasterList Start Row
Do Until ThisWorkbook.Sheets("Data Base").Cells(MLRow, 3) = ""
If DBWks.Cells(MLRow, 3).Value = NewFormWks.Cells(7, 4).Value Then
DBWks.Cells(MLRow, 2).Value = NewFormWks.Cells(5, 7).Value 'Division
DBWks.Cells(MLRow, 3).Value = NewFormWks.Cells(7, 4).Value 'Contract
No
DBWks.Cells(MLRow, 4).Value = NewFormWks.Cells(7, 7).Value 'Branch
MLRow = 5
Exit Do
End If
MLRow = MLRow + 1
If DBWks.Cells(MLRow, 3).Value = "" Then
DBWks.Cells(MLRow, 2).Value = NewFormWks.Cells(5, 7).Value 'Division
DBWks.Cells(MLRow, 3).Value = NewFormWks.Cells(7, 4).Value
'Contract No
DBWks.Cells(MLRow, 4).Value = NewFormWks.Cells(7, 7).Value 'Branch
End If
Loop