Where is a sample formula for retrieving the system date?

A

Artemis

Hello:

I am very new to coding and would appreciate some guidance. Does anyone
know or are there any sites which give sample code for VB in Excel and most
specifically having a spreadsheet "pull" the system date. I am going to
University plus working for accounting firms, so don't know where to search
on begin on looking to have a macro which displays the date code. Also, is
there any code for counting say to put an invoice number on a spreadsheet.
Thanks for all of your help.
 
L

Leith Ross

Hello Artemis,

You can return the system date and time by [lacing the formula below i
a cell on your worksheet

=NOW()

As for the rest of question, there is a plethora of books on usin
Excel as well as writing macros. First you need to learn the basics o
a spreadsheet, learn where and how to use the help files, and finall
move on to more advanced topics.

Sincerely,
Leith Ros
 
D

Dave Peterson

Leith gave you a function for date and time.

=today() gives the date.

You can also use a short cut key to put the current date in a cell:
ctrl-; (control-semicolon)

ctrl-: (control-shift-semicolon or control-colon)
will give the time.

The formulas
=today()
=now()
will change when the date/time changes (and the workbook recalculates)
 
G

Guest

Leith's excellent advice notwithstanding, a useful primer on Excel
macros and VBA is:

"VBA and Macros for Microsoft Excel" by Jelen and Syrstad, published
by Que. Try visiting www.MrExcel.com.

/Cal/
 
D

David McRitchie

Hi Artemis,
Dave Peterson gave you answers using worksheet formulas, the formatting
of the date relies on your system short date (Control Panel). You can modify
the format from that default.

But I expect the your question really concerns use in VBA, so you would
want to look up DATE from the Visual Basic Editor (VBE) in HELP from there.

More information on Date and Time can be found in
http://www.mvps.org/dmcritchie/excel/datetime.htm
http://www.cpearson.com/excel/datetime.htm

In rereading the question, you definitely asked about VB, so the subject does
not match the question. Asking questions takes quite a bit of effort to ask a
question and get an answer the first time that is one that would work best for you.
If you asked for a specific format for instance you would get a specific answer.

Since you are taking Excel in University you certainly should be familiar with the
many excellent Excel tutorials available online to anyone.
http://www.mvps.org/dmcritchie/excel/excel.htm#tutorials
 
Top