From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use the current date and time

Use the current date and time - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Use the current date and time

- [Narrator] One of the most important and sometimes overlooked bits of information, when you work with data in Excel, are the date and time when something happened. In this movie, I will show you how to find the current date and time using Excel VBA. My sample file is 0404 data and time.xlsm, and that's an Excel macro enabled workbook you can find in the chapter four folder of the exercise files collection. I have a worksheet with some data in the main workbook but we're not going to work with it. So instead, I'll press Alt + F11, to move over to the Visual Basic Editor. And here, you see that I have two code modules, and within module one which is currently displayed, I have two subroutines. I'll start by working in display date and time at the top. And I have two message boxes there, the first is to display the date and the second is to display the time. And the keywords that use for that information are as you might…

Contents