Solved

Work book and vba

Posted on 2015-02-06
8
47 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40593805
a. Scratch my comment - I'm surprised it works, but it does.
0
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

809 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