+ Reply to Thread
Results 1 to 7 of 7

Thread: excel to enter time but not update it

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    new york, usa
    MS-Off Ver
    Excel 2007
    Posts
    44

    excel to enter time but not update it

    I have a logsheet that i wanto be able to see what time certain cells were updated,

    in column a row 1 i enter the phone number of a client, i want column b row 1 should enter the current time and the time should stay there (and not be updated when b2 or b3 were updated)

    also is there a way to store a autorun macro only in 1 workbook??
    i have multiple workbooks open and in the logsheet i have a autorun macro that runs every 5 seconds which saves the log so that no data gets mistakenly erased, but if im currently working on another worksheet (order form) the macro tries running in the open worksheet and it spits an error saying something like: cant save file cuz u havto save it as a macro enabled workbook, but i dont wanto really save the order form i wanto save the logsheet.

    any advice??

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: excel to enter time but not update it

    Hi hqradio,

    For the second question, it sounds like the macro that fires every 5 seconds needs some work. You may need to modify it so it is specific on what file to save instead of ActiveWorkbook.

    For question 1 about putting in the current time when a phone number is entered in Col A you need an event macro, in my opinion. Find the attached with code behind Sheet1:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("A1:A1000")) Is Nothing Then
            Cells(Target.Row, "B") = Now()
        End If
    End Sub
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Registered User
    Join Date
    01-13-2011
    Location
    new york, usa
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: excel to enter time but not update it

    thanks, it works great.

    do you have the code for my 2nd question?? i dont have any idea how to do it....

  4. #4
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: excel to enter time but not update it

    Search for "Excel VBA OnTime Repeat"
    and study the code you find. Your second question is a lot harder.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  5. #5
    Registered User
    Join Date
    01-13-2011
    Location
    new york, usa
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: excel to enter time but not update it

    i understand its alot harder but i cant even do the easy stuff.....

    can anyone help?.......

  6. #6
    Registered User
    Join Date
    01-13-2011
    Location
    new york, usa
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: excel to enter time but not update it

    i currently have this code in the file:

    Public dTime As DateSub MyMacro()dTime = Now + TimeValue("00:15:00")Application.OnTime dTime, "MyMacro"
    
    'YOUR CODEEnd Sub
    but it runs on any open workbook,

    its probably very simple but please help me
    thank you

  7. #7
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: excel to enter time but not update it

    Hi,

    Read more at
    http://www.cpearson.com/excel/OnTime.aspx or
    http://answers.microsoft.com/en-us/o...0-f10a8fe474cf or
    http://www.dailydoseofexcel.com/arch...ontime-method/
    http://support.microsoft.com/kb/151503

    Part of the learning process is to try and fail and read and learn until it works. The above should give you enough information.

    My question is - Does the code go behing a Sheet, the Workbook or in a Module?
    One test is worth a thousand opinions.
    Click the * below to say thanks.

+ 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.2.0