Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
initialize form field from previous entry
I'm using the menu's Data Form function called by a macro to enter new records to a spreadsheet database used to track employee time to be billed on client matters. For simplicity, assume the fields corresponding to the columns in the database a employee, file number, time, code and code description. It is common that groups of related records are entered in sequence where, for example, each new record in a group is has the same file number and employee. Employee and code fields validate from respective lists. Code decription field populates from a VLOOKUP function based on code field entered. I'm calling the Data Form from the menu via a macro. Each new entry, however, begins with a clear cell for each field. I'd like to have the fields, at least employee and file number fields, for each new record to be added initialize with the values entered for the immediately previous record so that the information does not need to be re-entered for each new record. Is there any way to do this using the Data Form? Will I need to create a different data entry form in VB? Very much a newbie attempting this but generally a quick study. Thanks! -- Message posted via http://www.officekb.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
initialize form field from previous entry
As far as I can tell, You will need to create a text_box Enter privat sub I just put 1 small column of data in but the theory should hold tru for your example. For each field you want to be pre populated you coul reference the colomn in the last data you entered. I referenced A1 a the only cell to look at, but in your case you're constantly enterin in data into multiple columns so you'll have to code in something lik this for each column of data, and subsequently each text box: Private Sub TextBox1_Enter() 'locate the column of data you want to reference the last cell in Range("A1").select 'Find the last cell (assuming no blank cells) Selection.End(xlDown).Select TextBox1.Value = Selection.Value End Sub Keep in mind you'll also need the requisite TextBox_1Change() to ente your data into the next cell. Hope this helps -- TylerDurde ----------------------------------------------------------------------- TylerDurden's Profile: http://www.excelforum.com/member.php...fo&userid=1763 View this thread: http://www.excelforum.com/showthread.php?threadid=39021 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
restricting entry into a cell based on entry to a previous cell | New Users to Excel | |||
Active X Controls Tabbing from Form Field 2 Form Field | Excel Discussion (Misc queries) | |||
Form. to ignore cells w/o value from calc from previous Form. | Excel Worksheet Functions | |||
Closing user form in Initialize macro? | Excel Programming | |||
need form to initialize without closing | Excel Programming |