Link to home
Start Free TrialLog in
Avatar of bjfulkerson
bjfulkerson

asked on

Work book and vba

This is a timesheet entry and employee update doc to track productivity.

1.      I would like the cursor to start in the INITIALS box.  Currently, when the initials are entered it auto pops the FNAME, LNAME, STATUS and HDEPT.
a.      I would like the cursor to jump to the FUNCTION CODE box and using the tab to the A#, TIME, UNITS, ADD button.
b.      After pressing enter when the ADD button is active, can the A# box be cleared?
2.      All this data updates the Timesheet Tab
a.      When I ADD, I get an error
 Runtime error 424
the debugger highlights     .Cells(lastrow + 1, "G").Value = TxtUPH.Text


Private Sub ccmdAdd_Click()
   Dim lastrow As Long
   
   With Sheets("Timesheet")
     lastrow = .Range("A1048576").End(xlUp).Row
    'lastrow = Sheets("Timesheet").Range("A2").End(xlDown).Row
    .Cells(lastrow + 1, "A").Value = ComboBox1.Text
    .Cells(lastrow + 1, "B").Value = TxtDate.Text
    .Cells(lastrow + 1, "C").Value = CB2FunctionCode.Text
    .Cells(lastrow + 1, "D").Value = TxtA.Text
    .Cells(lastrow + 1, "E").Value = TxtTime.Text
    .Cells(lastrow + 1, "F").Value = TxtUnits.Text
    .Cells(lastrow + 1, "G").Value = TxtUPH.Text
    .Cells(lastrow + 1, "H").Value = TxtFname.Text
    .Cells(lastrow + 1, "I").Value = TxtLName.Text
    .Cells(lastrow + 1, "J").Value = TxtHDept.Text
   
   End With
 
 End Sub
 
b.      When I enter a new line item through the TIME SHEET ENRTY it removes the functions that are in place.  I have a VLOOKUP function in the DESCRIPTION column to add the description by the code entered and in UNITSperHR.  It doesn’t update the rest of the information LNAME, FNAME and HDEPT.  See row 35 and 36 for example.
Thanks for your time

Jody
Avatar of Phillip Burton
Phillip Burton

a. It's because you are using this syntax:

.Cells(lastrow + 1, "A")

it should be

.Cells(lastrow + 1, 1)
b. See row 35 and 36 for example.

I can't do so - you haven't attached anything.
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
a. Scratch my comment - I'm surprised it works, but it does.
a. Scratch my comment - I'm surprised it works, but it does.
I was too.
@Martin Liss
Just a question how come you posted a file that have tables and sheets and seems it is OP file that was not neither posted in this question nor there is a link to previous question ?

Kindly clarify
gowflow
The workbook came from this question and the author forgot to post the workbook here.
Ahhh ic you had worked on it before and this is continuation !!! mmm good as for 1 minute I though there was voodoo around here and some telepathic going around got you to get the file !!
So I'll leave you to handle this as sure in good hand !

gowflow