The data is provided in excel sheet and input should be asked in a input box or in other cell in the excel. Now input should be taken then check if any person is present on those days and should reflect who is present in the output.
I wrote a code but unable to find where i have gone wrong. Please help me out in rectifying the code or create a new code
Sub Sai_Aircraft_log_entry1()
Dim p, e1, e2 As Date
Worksheets("Test2").Select
e1 = Cells(5, 11).Value
e2 = Cells(6, 11).Value
Sheets("Output2").Cells.Clear
Worksheets("Output2").Select
Range("A2").Select
Dim n, m, k, s As Integer
    Worksheets("Test2").Select
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    n = Range(Selection, Selection.End(xlDown)).Count
    
Dim i, o As Date
Dim x As Integer
Dim A As String
    
    For p = e1 To e2
        Worksheets("Output2").Select
        ActiveCell.Select
        ActiveCell.Value = p
        ActiveCell.Offset(0, 1).Select
    
        For x = 2 To n
           Worksheets("Test2").Select
        'bring below line up
            i = Cells(x, 5).Value
            o = Cells(x, 6).Value
            A = Cells(x, 3).Value
            If i =< p and o => p Then
                '
                Worksheets("Output2").Select
                ActiveCell.Value = A
                ActiveCell.Offset(0, 1).Select
             End If
    Next x
    Worksheets("Output2").Select
    Range(Selection, Selection.End(xlToLeft)).Select
    m = Range(Selection, Selection.End(xlToLeft)).Count
    k = m * -1
    s = k + 2
    'MsgBox k
    ActiveCell.Offset(1, 0).Select
    'MsgBox k
    ActiveCell.Offset(0, s).Select
    Next p
End Sub



 
     
    