+ Reply to Thread
Results 1 to 5 of 5

Date formula that wont change the values each day.

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Woodbridge, Suffolk
    MS-Off Ver
    Excel 2010
    Posts
    9

    Date formula that wont change the values each day.

    Im sure there is a simple answer to this, but cant get to it. I have an excel workbook that keeps records on a daily basis. One of the fields I fill in is the date. I understand that i can have the formula =TODAY() that will automatically imput the date that is on my computer system which is what i want, but when i open it up the next day, because the formula is still there, the records that i put in yesterday will have today's date in.

    Is there anyway so that when i go to save it, it saves the value in the cell. Think i need a different formula.
    Hope I have explained it OK.

    Many Thanks

    seanturner9005

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Date formula that wont change the values each day.

    Hi seanturner9005

    How about using on the keyboard.

    CTRL + ;
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: Date formula that wont change the values each day.

    Use this VBA
    Please Login or Register  to view this content.
    You can attach this to a command button.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    03-19-2013
    Location
    Woodbridge, Suffolk
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Date formula that wont change the values each day.

    Kevin, Thanks for the reply. Handy little shortcut to know, but am trying to tie this into a userform if possible.Alan also many thanks for the reply, think this is what i need. In VBA would you possibly be able to tell me where i enter this so it automatically fills one of the text boxes on my userform. Im new with VBA as of last week so still trying to get my head around it.

    'check for a part number
    If Trim(Me.txtdat.Value) = "" Then
    Me.txtdat.SetFocus
    MsgBox "Please enter a date"
    Exit Sub
    End If

    'copy the data to the database
    ws.Cells(iRow, 2).Value = Me.txtdat
    ws.Cells(iRow, 3).Value = Me.txtComCode.Value
    ws.Cells(iRow, 6).Value = Me.txtItem.Value
    ws.Cells(iRow, 8).Value = Me.ComboBox1.Value
    ws.Cells(iRow, 9).Value = Me.txtNote.Value
    ws.Cells(iRow, 10).Value = Me.txtgreentree.Value


    'clear the data
    Me.txtdat.Value = ""
    Me.txtComCode.Value = ""
    Me.txtItem.Value = ""
    Me.ComboBox1.Value = ""
    Me.txtNote.Value = ""
    Me.txtgreentree.Value = ""
    Me.txtdat.SetFocus

    End Sub

    Private Sub cmdClose_Click()
    Unload Me
    End Sub

    Private Sub TextBox1_Change()

    End Sub

    Private Sub ListBox1_Click()

    End Sub

    Private Sub txtDate_Change()

    End Sub

    Private Sub txtPart_Change()

    End Sub

    Private Sub txtQty_Change()

    End Sub

    Private Sub txtdat_Change()

    End Sub

    Private Sub UserForm_QueryClose(Cancel As Integer, _
    CloseMode As Integer)
    If CloseMode = vbFormControlMenu Then
    Cancel = True
    MsgBox "Please use the button!"
    End If
    End Sub





    HOPE THIS MAKES SENSE, SORRY IF IM JUST TALKING CR#P

  5. #5
    Registered User
    Join Date
    03-19-2013
    Location
    Woodbridge, Suffolk
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Date formula that wont change the values each day.

    Kevin, Thanks for the reply. Handy little shortcut to know, but am trying to tie this into a userform if possible.Alan also many thanks for the reply, think this is what i need. In VBA would you possibly be able to tell me where i enter this so it automatically fills one of the text boxes on my userform. Im new with VBA as of last week so still trying to get my head around it.

    'check for a part number
    If Trim(Me.txtdat.Value) = "" Then
    Me.txtdat.SetFocus
    MsgBox "Please enter a date"
    Exit Sub
    End If

    'copy the data to the database
    ws.Cells(iRow, 2).Value = Me.txtdat
    ws.Cells(iRow, 3).Value = Me.txtComCode.Value
    ws.Cells(iRow, 6).Value = Me.txtItem.Value
    ws.Cells(iRow, 8).Value = Me.ComboBox1.Value
    ws.Cells(iRow, 9).Value = Me.txtNote.Value
    ws.Cells(iRow, 10).Value = Me.txtgreentree.Value


    'clear the data
    Me.txtdat.Value = ""
    Me.txtComCode.Value = ""
    Me.txtItem.Value = ""
    Me.ComboBox1.Value = ""
    Me.txtNote.Value = ""
    Me.txtgreentree.Value = ""
    Me.txtdat.SetFocus

    End Sub

    Private Sub cmdClose_Click()
    Unload Me
    End Sub

    Private Sub TextBox1_Change()

    End Sub

    Private Sub ListBox1_Click()

    End Sub

    Private Sub txtDate_Change()

    End Sub

    Private Sub txtPart_Change()

    End Sub

    Private Sub txtQty_Change()

    End Sub

    Private Sub txtdat_Change()

    End Sub

    Private Sub UserForm_QueryClose(Cancel As Integer, _
    CloseMode As Integer)
    If CloseMode = vbFormControlMenu Then
    Cancel = True
    MsgBox "Please use the button!"
    End If
    End Sub





    HOPE THIS MAKES SENSE, SORRY IF IM JUST TALKING CR#P

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: Date formula that wont change the values each day.

    I would add it as follows at the end of the list of data you are transferring to the spreadsheet from the form.

    ie.
    Please Login or Register  to view this content.
    where x is the column number where you want to place the date.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1