Automatic Date Entry

  • Im trying to put the current date into cell S1 for other calculations.
    Im using:


    Code
    Private Sub Worksheet_Open(ByVal Target As Range) 
        If Target.Cells.Count > 1 Then Exit Sub 
        If Target.Address = "$T$1" Then 
            Target(1, 2) = Date 
        End If 
    End Sub


    This works but when I go to use the date for other calculation or to show in other cells I get "1/0/1900 0:00"


    Thank you for any help!

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Automatic Date Entry


    If you want the date entering on opening, this should do

    Code
    Private Sub WorkBook_Open() 
       Range("T1").value= Date 
    End Sub
  • Re: Automatic Date Entry


    Don't you mean worksheet_activate? There is no mention of a worksheet_open in my VBE!


    Alastair

    Einstein:
    Things should be made as simple as possible, but not any simpler


    Be sure to check out TemplateZone for all your Microsoft Office Needs.
    Get OfficeReady Professional 3.0 here!

  • Re: Automatic Date Entry


    My apoligizes I dont think I gave enough information. But you did help me out. I realized what I did with the code isnt really what I need at all. What I want to do is put todays date vale in cell S1. I think the code might have just formatted. I just spent some time playing with date formulas with no luck, I have never used these functios before. So my new question is, should I keep messing with the code or go for the formula? :?




    Norie Thanks for helping me figure out where to post.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Automatic Date Entry


    sorry hasty cut and pasting...........


    i meant,

    Code
    Private Sub Workbook_Open()
    ActiveSheet.Range("s1").Value = Date
    
    
    End Sub


    that does work!

  • Re: Automatic Date Entry


    Thank you all very much.
    It all worked. I used the today function along with the code. I did change open to activate. It seemed to help it out.


    Thanks again.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!