1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need macro for Attendance Tracker

Discussion in 'VBA Macros' started by pi_sa11, Jun 19, 2017.

  1. pi_sa11

    pi_sa11 New Member

    Messages:
    7
    Hi,

    I wanted to develop a excel macro which should perform below operations. I have attached file for the reference. In sheet "Detail" raw data is placed. In row 7 from data & to date is present which will be a month.

    1) Now develop a macro which will insert automatic date in a month in row 1 of the sheet "InTime", "InitialStatus", "ModStatus".

    2) Develop a macro which will insert in time, out time & work time in accordance with date, employee name & employee ID in sheet InTime. Please note the structure of the sheet InTime is demo only, as out time & work time columns are not present. you may insert asper your convenience.

    3) Write a macro which will insert automatic data of attendance i.e.. P(Present),A(absent) in sheet "InitialStatus" with respect to date, employee name & employee id.

    Attached Files:

  2. p45cal

    p45cal Well-Known Member

    Messages:
    757
    Code (vb):
    Sub Status()
    Set WorkSht = Sheets("Detail")
    Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count))
    Set Destn = NewSht.Range("A3")
    With NewSht
      .Range("C1").Value = 1
      .Range("C1").DataSeries Rowcol:=xlRows, Type:=xlLinear, Stop:=31
      .Range("A2:B2").Value = Array("EmployeeName", "EmployeeID")
      .Range("C2:AG2").Value = "Status"
    End With
    With WorkSht.Columns(1)
      Set c = .Find("Empcode :", lookat:=xlWhole, LookIn:=xlFormulas, searchformat:=False)
      If Not c Is Nothing Then
        firstAddress = c.Address
        Do
          Set myDataRng = c.Range("B1,D1,B12:AF12")
          Destn.Value = myDataRng.Areas(2).Value  'name
         Destn.Offset(, 1).Value = myDataRng.Areas(1).Value  'empcode
         Destn.Offset(, 2).Resize(, 31).Value = myDataRng.Areas(3).Value
          Set Destn = Destn.Offset(1)
          Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstAddress
      End If
    End With
    End Sub


    Sub InTime()
    Set WorkSht = Sheets("Detail")
    Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count))
    Set Destn = NewSht.Range("A3")
    With NewSht
      .Range("C1").Value = 1
      .Range("C1").DataSeries Rowcol:=xlRows, Type:=xlLinear, Stop:=31
      .Range("A2:B2").Value = Array("EmployeeName", "EmployeeID")
      .Range("C2:AG2").Value = "InTime"
    End With
    With WorkSht.Columns(1)
      Set c = .Find("Empcode :", lookat:=xlWhole, LookIn:=xlFormulas, searchformat:=False)
      If Not c Is Nothing Then
        firstAddress = c.Address
        Do
          Set myDataRng = c.Range("B1,D1,B5:AF5")
          Destn.Value = myDataRng.Areas(2).Value  'name
         Destn.Offset(, 1).Value = myDataRng.Areas(1).Value  'empcode
         With Destn.Offset(, 2).Resize(, 31)
            .Value = myDataRng.Areas(3).Value
            .NumberFormat = "hh:mm"
          End With
          Set Destn = Destn.Offset(1)
          Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstAddress
      End If
    End With
    End Sub
    Thomas Kuriakose likes this.

Share This Page