Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jul 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatically fill in date (Excel2000)

    Is there a way to automatically fill the current date into a cell, if it is blank, when the cell is selected?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatically fill in date (Excel2000)

    You can put the code below in the Worksheet Selection Change routine in the module behind the sheet. You will need to change the "D1" in the first line to the cell where you want the date put.

    <pre>Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Const strDateCell As String = "D1"
    If Not Intersect(Target, ActiveSheet.Range(strDateCell)) Is Nothing Then
    If ActiveSheet.Range(strDateCell).Value = "" Then
    ActiveSheet.Range(strDateCell).Value = Date
    End If
    End If
    End Sub
    </pre>

    Legare Coleman

  3. #3
    New Lounger
    Join Date
    Jul 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatically fill in date (Excel2000)

    Thank you! It works brilliantly. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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