#1
|
|||
|
|||
Auto-enter today's date with New Order Macro button?
I need some coding help with a data entry form I've downloaded from contextures.com and customized for our company use. Sheet 1 (Input) is the data entry form, sheet 2 (RequestData) is the database sheet, sheet 3 (LookupLists) is for...Lookup Lists! Internal clients will fill out the form on sheet 1 (which is all they'll be able to see); then when they Submit the form, the data enters to sheet 2, and all the fields on sheet 1 clear for next use. I've gotten everything to work the way it's supposed to, but now I want to change/add a few functionalities and can't seem to find exactly what I'm looking for out on the web or in these forums. (I'm sure it's fairly simple if you have the coding knowledge!)
I have a "New Order" button on the data entry sheet that automatically pulls the next Order ID from a Lookup List on sheet3 and places it in the 1st field on the form. What I'd like to add to that macro is the code to automatically place today's date in the next field. IDNum is the name of the Order ID field, NextID is the field name that it pulls from on LookupLists, using the formula: =IFERROR(MAX(RequestData!C:C)+1,0) I guess I would need to name the date field, i.e. "TodaysDate"? Would it also pull from info/formula added on LookupLists? Thanks for any help you can offer!!! Here's the macro code currently attached to that button: Sub StartNewRecord() Dim inputWks As Worksheet Dim listWks As Worksheet Dim rngClear As Range Dim rngNext As Range Dim rngID As Range Set inputWks = Worksheets("Input") Set listWks = Worksheets("LookupLists") Set rngClear = inputWks.Range("DataEntryClear") Set rngID = inputWks.Range("IDNum") Set rngNext = listWks.Range("NextID") rngClear.ClearContents rngID.Value = rngNext.Value inputWks.Activate rngID.Offset(1, 0).Activate End Sub |
#2
|
|||
|
|||
Hello -
In order to insert the current date into a cell you could use: Code:
ActiveCell.Value = Date Code:
cDate.value = Date |
#3
|
|||
|
|||
Thanks for the suggestion, OfficeNewb! I have named that field TodaysDate, so it would be:
Code:
TodaysDate.value = Date Thanks much for your assistance, barbd |
#4
|
||||
|
||||
@barbd777
Please wrap code with code tags - Thank you
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#5
|
|||
|
|||
Sorry about that, Pecoflyer--(I really am a newbie!) Do I need to edit my original post? (Not seeing any Edit button?)
Thanks, barbd |
#6
|
|||
|
|||
Quote:
|
#7
|
|||
|
|||
Solved!
Thank you, OfficeNewb, for your replies. It is a cell on a worksheet that is set up as an order entry form.
I did find my answer on another forum: http://www.excelforum.com/excel-prog...ro-button.html Code:
Sub StartNewRecord() Dim inputWks As Worksheet Dim listWks As Worksheet Dim rngClear As Range Dim rngNext As Range Dim rngID As Range Dim rngOrderDate As Range Set inputWks = Worksheets("Input") Set listWks = Worksheets("LookupLists") Set rngClear = inputWks.Range("DataEntryClear") Set rngID = inputWks.Range("IDNum") Set rngNext = listWks.Range("NextID") Set rngOrderDate = inputWks.Range("TodaysDate") rngClear.ClearContents rngID.Value = rngNext.Value rngOrderDate = Date inputWks.Activate rngID.Offset(1, 0).Activate End Sub |
Tags |
date, macro automatic |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show date instead of Today, Yesterday . . | BrazzellMarketing | Outlook | 7 | 08-15-2013 07:32 AM |
Today's Date Function | freschij | Excel | 3 | 02-11-2011 10:21 AM |
Creating an Auto-Calc'd Date? Today+7 Days? | SoCalTelephone | Word | 0 | 10-06-2010 10:27 AM |
new appointment date always reverts back to today's date | msills | Outlook | 0 | 08-24-2007 08:57 AM |
Imported message date change to today's date | promark | Outlook | 1 | 12-23-2005 07:21 AM |