+ Reply to Thread
Results 1 to 7 of 7

code need for time stamp

  1. #1
    wildauk
    Guest

    code need for time stamp

    Hi, I need a code for a button so when I press it the time is shown in say
    cell A1 and it will not change untill I press the button agian.

    Thank's inadvance, Barry.

  2. #2
    Die_Another_Day
    Guest

    Re: code need for time stamp

    ActiveCell = Time 'Time only
    ActiveCell = Date & " " & Time 'Date And Time

    HTH

    Die_Another_Day

    wildauk wrote:
    > Hi, I need a code for a button so when I press it the time is shown in say
    > cell A1 and it will not change untill I press the button agian.
    >
    > Thank's inadvance, Barry.



  3. #3
    Die_Another_Day
    Guest

    Re: code need for time stamp

    Range("A1") = Time 'Time only
    Range("A1") = Date & " " & Time 'Date And Time

    HTH


    Die_Another_Day

    wildauk wrote:
    > Hi, I need a code for a button so when I press it the time is shown in say
    > cell A1 and it will not change untill I press the button agian.
    >
    > Thank's inadvance, Barry.



  4. #4
    Jim Thomlinson
    Guest

    RE: code need for time stamp

    Try this...

    public sub AddTimeStamp()
    activesheet.range("A1").value = now()
    end sub

    --
    HTH...

    Jim Thomlinson


    "wildauk" wrote:

    > Hi, I need a code for a button so when I press it the time is shown in say
    > cell A1 and it will not change untill I press the button agian.
    >
    > Thank's inadvance, Barry.


  5. #5
    wildauk
    Guest

    Re: code need for time stamp

    yes that worked thank you, is there any way I can only have the time without
    the date?

    "Die_Another_Day" wrote:

    > Range("A1") = Time 'Time only
    > Range("A1") = Date & " " & Time 'Date And Time
    >
    > HTH
    >
    >
    > Die_Another_Day
    >
    > wildauk wrote:
    > > Hi, I need a code for a button so when I press it the time is shown in say
    > > cell A1 and it will not change untill I press the button agian.
    > >
    > > Thank's inadvance, Barry.

    >
    >


  6. #6
    Jim Thomlinson
    Guest

    Re: code need for time stamp

    My preference is to always capture both date and time. If you want to you can
    change the formatting of the cell to only display the time. If however later
    on you decide that you want both then you do not need to change the code,
    only to change the formatting of the cell. It gives you more flexibility to
    change your mind...
    --
    HTH...

    Jim Thomlinson


    "wildauk" wrote:

    > yes that worked thank you, is there any way I can only have the time without
    > the date?
    >
    > "Die_Another_Day" wrote:
    >
    > > Range("A1") = Time 'Time only
    > > Range("A1") = Date & " " & Time 'Date And Time
    > >
    > > HTH
    > >
    > >
    > > Die_Another_Day
    > >
    > > wildauk wrote:
    > > > Hi, I need a code for a button so when I press it the time is shown in say
    > > > cell A1 and it will not change untill I press the button agian.
    > > >
    > > > Thank's inadvance, Barry.

    > >
    > >


  7. #7
    Die_Another_Day
    Guest

    Re: code need for time stamp

    See first line...
    "Die_Another_Day" wrote:

    Range("A1") = Time 'Time only

    Die_Another_Day
    wildauk wrote:
    > yes that worked thank you, is there any way I can only have the time without
    > the date?
    >
    > "Die_Another_Day" wrote:
    >
    > > Range("A1") = Time 'Time only
    > > Range("A1") = Date & " " & Time 'Date And Time
    > >
    > > HTH
    > >
    > >
    > > Die_Another_Day
    > >
    > > wildauk wrote:
    > > > Hi, I need a code for a button so when I press it the time is shown in say
    > > > cell A1 and it will not change untill I press the button agian.
    > > >
    > > > Thank's inadvance, Barry.

    > >
    > >



+ 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