+ Reply to Thread
Results 1 to 17 of 17

userfrom consist of 3 list box to insert attendance for employee

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: userfrom consist of 3 list box to insert attendance for employee

    Dear Leo
    i found your code work good but i note two problem
    first when i press add attendance to sheet its add data even the textbox for date is empty and when i press again its the same data to next column and soon without look to corresponding date
    also when i press button transfer from is also work good from present list to absent but if i want to return it again its remove the data from list box without return it


    Quote Originally Posted by LeoTaxi View Post
    Made listbox1 multi select, so first select all items


    Private Sub CommandButton1_Click()
    Dim i As Integer, j As Integer, jj As Integer
    ReDim arr(1 To ListBox1.ListCount)
    ReDim arr2(1 To ListBox1.ListCount)
    
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(i) Then
            j = j + 1
            arr(j) = ListBox1.List(i)
        Else
            jj = jj + 1
            arr2(jj) = ListBox1.List(i)
        End If
    Next
    ListBox1.Clear
    ListBox1.List = arr2
    ListBox2.List = arr
    End Sub
    
    Private Sub CommandButton2_Click()
    With Sheets("Attendance")
        For i = 0 To UserForm1.ListBox1.ListCount - 1
            myrow = Application.Match(UserForm1.ListBox1.List(i), .Range("A:A"), 0)
            If Not IsError(myrow) Then .Cells(myrow, .Columns.Count).End(xlToLeft).Offset(, 1) = "Present"
        Next
        For i = 0 To UserForm1.ListBox2.ListCount - 1
            myrow = Application.Match(UserForm1.ListBox2.List(i), .Range("A:A"), 0)
            If Not IsError(myrow) Then .Cells(myrow, .Columns.Count).End(xlToLeft).Offset(, 1) = "Absent"
        Next
        For i = 0 To UserForm1.ListBox3.ListCount - 1
            myrow = Application.Match(UserForm1.ListBox3.List(i), .Range("A:A"), 0)
            If Not IsError(myrow) Then .Cells(myrow, .Columns.Count).End(xlToLeft).Offset(, 1) = "Present other"
        Next
    End With
    End Sub
    
    Private Sub CommandButton3_Click()
    Dim i As Integer
    ReDim arr(1 To ListBox1.ListCount)
    ReDim arr2(1 To ListBox1.ListCount)
    
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(i) Then
            j = j + 1
            arr(j) = ListBox1.List(i)
        Else
            jj = jj + 1
            arr2(jj) = ListBox1.List(i)
        End If
    Next
    ListBox1.Clear
    ListBox1.List = arr2
    ListBox3.List = arr
    End Sub
    Kind regards
    Leo

  2. #2
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: userfrom consist of 3 list box to insert attendance for employee

    please see my attached file with new userform design
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Employee Attendance Tracker Help :)
    By Block118 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-18-2017, 06:48 AM
  2. Employee Attendance help please
    By fredek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2016, 12:06 PM
  3. [SOLVED] Employee Attendance Template
    By mcanny in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-18-2016, 01:07 PM
  4. Track Employee Attendance
    By maabbas in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-17-2015, 08:17 AM
  5. Need Help - AutoCalculate Attendance Points for employee attendance records
    By switzd0d in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-17-2015, 03:00 PM
  6. Employee Attendance Record
    By PurpleMe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-23-2013, 02:15 AM
  7. employee attendance
    By ruth in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-08-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1