Based upon the code given at Post=19110 my final code is as follows.
Code: Select all
Private Sub cmdEdit_Click()
Dim r As Long
Select Case Me.cboSelection
Case "Orders"
For r = 1 To Range("Serial").Count
If Range("Serial").Cells(r) = Val(Me.txtSerial.Value) And _
Range("Code").Cells(r) = Val(Me.txtCode.Value) Then
Exit For
End If
Next r
If r > Range("Serial").Count Then
MsgBox "Serial Number/Code combination not found", vbExclamation
Exit Sub
End If
Range("Date").Cells(r).Value = CDate(txtDate.Value)
Range("Code").Cells(r).Value = txtCode.Value
MakeList
Case "Memos"
On Error Resume Next
r = Application.WorksheetFunction.Match(CLng(Me.txtSerialNo.Value), _
Range("Serials"), 0)
If Err Then
MsgBox "Serial Number not found", vbExclamation
Exit Sub
End If
On Error GoTo 0
Range("CustomerID").Cells(r).Value = txtCustomerID.Value
Range("ReceiptNo").Cells(r).Value = txtReceiptNo.Value
End Select
End Sub
Any help would be kindly appreciated.