Solved

Work book and vba

Posted on 2015-02-06
8
43 Views
Last Modified: 2016-02-10
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
0
Comment
Question by:bjfulkerson
  • 3
  • 3
  • 2
8 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40593792
a. It's because you are using this syntax:

.Cells(lastrow + 1, "A")

it should be

.Cells(lastrow + 1, 1)
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40593796
b. See row 35 and 36 for example.

I can't do so - you haven't attached anything.
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40593802
I couldn't reproduce the ADD error. All the changes are marked with
'new

Open in new window

Q-28611711.xlsm
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40593805
a. Scratch my comment - I'm surprised it works, but it does.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 40593809
a. Scratch my comment - I'm surprised it works, but it does.
I was too.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40595360
@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
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40595594
The workbook came from this question and the author forgot to post the workbook here.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40595735
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now