VBA : doing good just need to pull out the logoff from the l

  • ok i have almost got it, i have taking all your advice and now i just need to know how to find the logoff that coresponds to the log on that i pull out, here is my code i have come a long way from this morning all i need is this please help



    '1/28/2004 started creating the file


    Const LogCol = 1
    Const LogStartRow = 1
    Const UsernameCol = 2
    Const MachCol = 3
    Const DayCol = 4
    Const DateCol = 5
    Const TimeCol = 6
    Const MainStartRow = 1
    Const UserStartRow = 10
    Const UserStartCol = 2
    Const UserDayCol = 2
    Const UserDateCol = 3
    Const UserLogonCol = 4
    Const UserLogoffCol = 5
    Const UserMachCol = 6





    'Function to determine the row for a particular user


    Function UserRowFinder(Username)
    UserRowCounter = UserStartRow
    While Worksheets(Username).Cells(UserRowCounter, UserStartCol) <> ""
    UserRowCounter = UserRowCounter + 1
    Wend
    UserRowFinder = UserRowCounter
    End Function



    'Function to find the coresponding logoff for the logon


    Function LogoffFinder(Logoff)
    Logrow = LogStartRow
    While Worksheets("Log-Import").Cells(Logrow, LogCol).Value <> ""

    'enter code to find the logoff for the logons that have been found below


    End Function


    'This is the main SORTING Dog used to sort the log file into separate sheets by users
    Private Sub btnSort_Click()
    Logrow = LogStartRow
    While Worksheets("Log-Import").Cells(Logrow, LogCol).Value <> ""
    'Determine the username of the current row
    Username = Worksheets("Log-Import").Cells(Logrow, UsernameCol).Value

    'Determine the next available user row
    userrow = UserRowFinder(Username)
    'Enter the value of this user row to the appropriate user's sheet
    Worksheets(Username).Cells(userrow, UserDayCol).Value = Worksheets("Log-Import").Cells(Logrow, DayCol).Value
    Worksheets(Username).Cells(userrow, UserDateCol).Value = Worksheets("Log-Import").Cells(Logrow, DateCol).Value
    Worksheets(Username).Cells(userrow, UserLogonCol).Value = Worksheets("Log-Import").Cells(Logrow, TimeCol).Value

    'Call a function to find logoff and place appropriately.



    Worksheets(Username).Cells(userrow, UserMachCol).Value = Worksheets("Log-Import").Cells(Logrow, MachCol).Value

    MsgBox "Username: " & Username & " LogRow: " & Logrow & " Userrow: " & userrow & "DayCol: " & DayCol
    Logrow = Logrow + 1
    ' Wend
    Wend



    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!