• 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...

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

Tracking Employee work

PMRetired2012

New Member
I have two employees listed on a worksheet. Im using three collums to list data on the employes such a date they worked , and the amount i paid them.. names are (Kim and Sandy)
I am using a userform to enter this data. I enter each employes information and it puts the date and amount i paid under each name. The code below does that just fine.
Problem is:
When both employees works on the same day (Split shift) the way the code is below it shows it on two seperate rows. i would like it to show up as date and both names on same row.
emample of how i want it::

Row Date Column 1 Colum 2
1 11-10-20 25.00 35.00 (This is when they work a split shift and the way i want it all on one line)

Example of how the code blow shows on worksheet now:
Row Date Column 1 Colum 2
1 11-10-20 25.00
2 11-10-20 35.00 ( This is the way the code below show it on the worksheet.

I want to have the amounts on the same row instead of putting them on two rows when i enter them in the userform.
Hope i explained this good enough.

>>> use code - tags <<<
Code:
          Private Sub CommandButton3_Click()
Dim lr As Long
    Application.ScreenUpdating = True
    Sheet = ComboBox5.Text
    If Sheet = "" Then
      MsgBox "Select Month", vbInformation, "Error"
      Exit Sub
    End If
    Sheets(Sheet).Select
    lr = Range("V53").End(xlUp).Row + 1
    myName = ComboBox6.Text
    iDate = DTPicker3.Value
    If myName = "Sandy" Then myCol = "W"
    If myName = "Kim" Then myCol = "X"
    Range("V" & lr).Value = iDate
    Range(myCol & lr).Value = ComboBox10.Value
   
   
    'Sort Labor Costs
    Sheets(Sheet).Range("V2:X53").Sort key1:=Range("V2"), order1:=xlAscending, Header:=xlYes
   
   
   
  'Clear Form
  ComboBox6.Text = ""
  ComboBox10.Text = ""
 
End Sub
 
Last edited by a moderator:
Working without Excel in front of me, the lines:
Code:
rw=application.match(idate,range("V1:V" & lr).value,0)
if not(iserror(rw)) then lr=rw
immediately after
iDate = DTPicker3.Value
might work for you.
Much better if you attach a workbook so we can test easily and so that we don't make any (wrong) assumptions about your setup.
 
Back
Top