+ Reply to Thread
Results 1 to 3 of 3

Thread: Enter and Lock Current date when a number is entered into another cell

  1. #1
    Registered User
    Join Date
    01-24-2012
    Location
    Gorham, New Hampshire
    MS-Off Ver
    Excel 2007
    Posts
    5

    Enter and Lock Current date when a number is entered into another cell

    Hi,
    I am new here. I am slowly picking up some excel skills, but can't seem to figure this one out. I have also tried to tweak several macros that are close to what I need-but that always leads to a brick wall. Here's my goal:

    I type a number into column B. (This is an item # and my worksheet is already set up to fill in the rest of the columns-with information about that item from another worksheet. I don't neet help w/ that part.)
    Column A of the same row automatically fills in todays date. That date stays there unless I delete the number from Column B.
    So, if I use the worksheet tomorrow, the items I enter will have tomorrow's date, but all previous dates will stay how they were entered.

    Any ideas?

    Thank you!
    Last edited by Banyonb; 02-02-2012 at 04:02 PM.

  2. #2
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,004

    Re: Enter and Lock Current date when a number is entered into another cell

    Try this event driven macro

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Cell As Range
    For Each Cell In Target
        If Cell.Column = 2 Then
            Application.EnableEvents = False
            If Cell.Value <> "" Then
                Cell.Offset(0, -1) = Date
            Else
                Cell.Offset(0, -1) = ""
            End If
            Application.EnableEvents = True
        End If
    Next Cell
    End Sub
    Paste this into the appropriate sheet tab (e.g. Sheet1) in the VBA editor (Alt F11).
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  3. #3
    Registered User
    Join Date
    01-24-2012
    Location
    Gorham, New Hampshire
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Enter and Lock Current date when a number is entered into another cell

    This is perfect! Thank you, I never would have figured this out on my own.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0