• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Excel Formula

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Excel Formula

    Calling all Excel Experts

    I have a shared spreadsheet that i want to add a little bit of functionality to it. when i update cell with a value i want the next cell to display the Date on which it was updated. Does excell have a get date function ?

    Please help
    Thats the way the cookie crumbles

    #2
    there's the "NOW()" function which gives you a time/date stamp

    all you have to do is wrap an "onchange" event to the cell you want,
    and then trigger a NOW() population to the target

    something like...

    'put this anywhere
    sub onchange(ByVal target as Range)
    target.offset(0,1).value = now() 'this sets the cell to the right to the time
    end sub

    'put this against the worksheet
    'it picks up a specific cell and detects against it (A1)
    sub Worksheet_Change(ByVal target As Range)
    If target.Address = "$A$1" And target.Value > 0 Then
    Call onchange(target) 'this calls the sub above and parses in the cell
    End If
    end sub

    it's a rough one, but might help you get to the next step

    Comment


      #3
      rather than a macro you could link a1 to a2 then compare values and make a3 = now() or soemthing like that when the two cells aren't a match... obviously using IF and hiding a2 etc...

      you get the drift... depends on the macro security setting of the proposed target spreadsheet consumer i guess....
      --------------------------------------------------------------------------------

      SA - Is it like a dragons nostril?

      Comment


        #4
        Originally posted by kramer
        rather than a macro you could link a1 to a2 then compare values and make a3 = now() or soemthing like that when the two cells aren't a match... obviously using IF and hiding a2 etc...

        you get the drift... depends on the macro security setting of the proposed target spreadsheet consumer i guess....
        Thanks for help

        I went with a quick fix. If statement that when a cell doesn't match a certain value it populates another cell with TODAY(). when it does match the certain value then it displays nothing (blank)

        It works and is what i wanted
        Thats the way the cookie crumbles

        Comment


          #5
          Originally posted by Cooperinliverp00l
          Thanks for help

          I went with a quick fix. If statement that when a cell doesn't match a certain value it populates another cell with TODAY(). when it does match the certain value then it displays nothing (blank)

          It works and is what i wanted
          Bear in mind that every time you open the spreadsheet, or press F9 tho, the formula will recalculate and display the current date (rather than the date that the cell was changed)
          It's about time I changed this sig...

          Comment


            #6
            Bear in mind that every time you open the spreadsheet, or press F9 tho, the formula will recalculate and display the current date (rather than the date that the cell was changed)
            Then turn autocalculation off.

            Tools / Options / General (i think)

            Tickbox to turn on or off or do manually with F9.
            Of all tyrannies, a tyranny sincerely exercised for the good of its victims may be the most oppressive. It would be better to live under robber barons than under omnipotent moral busybodies. The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end for they do so with the approval of their own conscience.

            C.S. Lewis

            Comment


              #7
              But if you turn off autocalc, it will cause confusion to the poor end user. Think of the confusion and support calls you will generate (or even worst if they do not notice!) when their reports do not balance.

              IMHO the VBA mentioned above is a better option as it means that the poor user cannot overwrite your code (think about users doing cut /paste and messing up the hardcoded formula in the cell).

              As the VBA is forcing the value of the cell to be the date and not a formula, you do not have to worry about autocalc.

              Whenever I am doing anything like this I always go for the route that cuts down the users ability to mess it all up!

              Jon
              Twitter: jonsmile

              Comment

              Working...
              X