Revisions are noted in code.
Private Sub UserForm_Initialize()
Txtpilot.Value = ""
TxtNavs.Value = ""
TxtAesops.Value = ""
End Sub
Private Sub cmdAdd_Click()
Dim iRow, row_count As Long
Dim ws As Worksheet
'Added=================
Dim strDate As String
'======================
Set ws = Worksheets("404INFO TESTPAGE")
'Added=================
row_count = Range("A" & Rows.Count).End(xlUp).Row
Me.TxtDate.Value = Format(Me.TxtDate.Value, "short date")
'======================
For iRow = 2 To row_count
'Added=================
strDate = ws.Cells(iRow, 1).Value
'======================
'Changed===============
If strDate = Me.TxtDate.Value And UCase(ws.Cells(iRow, 3)) = UCase(Me.TxtSim.Value) Then
'======================
ws.Cells(iRow, 8) = Me.Txtpilot.Value
ws.Cells(iRow, 10) = Me.TxtNavs.Value
ws.Cells(iRow, 11) = Me.TxtAesops.Value
'Changed===============
Exit For
'======================
End If
Next iRow
'clear the data
Me.TxtDate.Value = ""
Me.TxtSim.Value = ""
Me.Txtpilot.Value = ""
Me.TxtNavs.Value = ""
Me.TxtAesops.Value = ""
Me.Txtpilot.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Bookmarks