You are here:

Excel/Forula to enter todays date, but not update

Advertisement


Question
Column A are blank cells for the user to type in someone's last name. Column B is shows the submission date for the form.

I would like for cell B6 through B26 to automatically enter today's date if any text (last name) is entered into the adjacent cell (so if I type any text in A6, the date appears in B6). This formula works great (with the cell formatted) =IF(ISTEXT($A6),TODAY(),"").

My issue, as you can see is that it will update daily and I need the date to stay the same once entered (i.e. the submission date).

Is there anyway to automate this with a formula and or VBA?

Answer
VBA answer... right-click the sheet tab and select VIEW CODE, then paste this macro into the sheet module that appears:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range

If Not Intersect(Target, Range("A:A")) Is Nothing Then
    For Each cell In Intersect(Target, Range("A:A"))
        If Len(cell) > 0 And Len(cell.Offset(, 1)) = 0 Then cell.Offset(, 1) = Now
    Next cell
End If

End Sub



Then close the VBEditor.  That should do it.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jerry Beaucaire

Expertise

Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files

Experience

Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files ===================== I have been offering free assistance as an Excel aid on many web sites for many years: (http://www.excelforum.com - JBeaucaire) ======== (http://www.askmehelpdesk.com/spreadsheets - JBeaucaire) ======= (http://www.mrexcel.com/forum - jbeaucaire)

Education/Credentials
Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2016 About.com. All rights reserved.