how to Insert Date Time Stamp with Excel VBA? – Simple steps!!
Tags: howtoinsertdatetimes, vbamacros
Published: 2021-09-24 01:49:58

---
title: how to Insert Date Time Stamp with Excel VBA? – Simple steps!!
published: true
date: 2021-09-19 10:10:33 UTC
tags: HowToInsertDateTimeS,VBAMacros
canonical_url: https://geekexcel.com/how-to-insert-date-time-stamp-with-excel-vba-simple-steps/
---

In this tutorial, we will guide you on how to  **insert a date-time stamp** with Excel VBA. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Show date and time whenever a change is made

- Firstly, you need to **create a VBA timestamp code** that runs every time when **change** is made in **column A**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Sample-data-24.png)<figcaption>Sample data</figcaption>

- In the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic](https://geekexcel.com/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A:A")) Is Nothing ThenOn Error Resume Next
If Target.Value = "" ThenTarget.Offset(0, 1) = ""
Else
Target.Offset(0, 1).Value = Format(Now, "mm/dd/yyyy HH:mm:ss")
End If
End If End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-55-1024x422.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Now, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.
- Finally, you will receive **output** as given below in **Microsoft Excel**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output-24.png)<figcaption>Output</figcaption>

## End of Era

We hope that this tutorial gives you guidelines on how to  **insert a date-time stamp** with Excel VBA. Please leave a comment in case of any  **queries,**  and don’t forget to mention your valuable  **suggestions**  as well. Thank you so much for Visiting Our Site!! Continue learning on **[Geek Excel](https://geekexcel.com/)!! **Read more on [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Read Also:**

- **[Excel Formulas to Find the Last Updated Date Stamp ~ Quick Tricks!!](https://geekexcel.com/excel-formulas-to-find-the-last-updated-date-stamp-quick-tricks/)**
- **[Excel Formulas to Convert Unix Time Stamp into Excel Date!!](https://geekexcel.com/excel-formulas-to-convert-unix-time-stamp-to-excel-date/)**
- **[How to Add an Input Message in Data Validation in Excel office 365?](https://geekexcel.com/how-to-add-an-input-message-in-data-validation-in-excel-office-365/)**
- **[Excel Formulas to Check the Conditional Message with REPT Function!!](https://geekexcel.com/excel-formulas-to-check-the-conditional-message-with-rept-function/)**
- **[Excel Office 365 Data Validation Options – Simple Instructions!!](https://geekexcel.com/excel-office-365-data-validation-options/)**