How to find a matching row and Insert Data
On Jan 4, 8:58*pm, hon123456 wrote:
Dear all,
* * * * * I have Excel with two Column, One column is named
Invoice_number and one column is named Checked_Value which will have
default value "" (Blank) . Invoice_number can have several thousand
rows. Now I write a userform1 with a textbox, when the user enter a
Invoice Number in the textbox, the VBA will try to find a matching
value in the the Column Invoice_number. How can I find a matching
value in column Invoice_number with Checked_value equal *"". After the
matching invoice number is found , the Checked_Value column will be
changed to "Yes", and this row will not be compared again when the
user enter Invoice number in textbox. How Can I do that?
Thanks
Dim i As String
Dim cell As Range
i = InputBox("Invoice number?")
If i = "" Then Exit Sub
For Each cell In Range("Invoice_number")
If cell.Value = i Then
cell.Offset(0, 1).Select
Selection.Value = "Yes"
End If
Next cell
|