+ Reply to Thread
Results 1 to 32 of 32

Automatic Date insert

  1. #1
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Automatic Date insert

    I asked this in another section and may have put it in the wrong place. so, here is my question.

    I have a "customer info column" column (b) and a "date column" column (a) is there a way that when i put a new customer into column B, that column A would automatically put the days date in which i put the new customer in column B. so b3 would have the new customers name and A3 would automatically have todays date (the day i input new customer) inserted.
    so b4=new customer a4=todays date, tomorrow i input another new customer and then b5=new customer a4=tomorrows date and so on down the line

    there is no "right click\insert date" or anything like that.
    Last edited by tregrad; 09-29-2009 at 03:35 PM.
    "I wish I knew half of what you guys have forgotten"

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Ctrl+; enters today's date.

    If you want to do it with code, see http://www.mcgimpsey.com/excel/timestamp.html
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor trucker10's Avatar
    Join Date
    07-22-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 / 2007 / 2010 prof +
    Posts
    149

    Re: Automatic Date insert

    You can use this code
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    ctrl+ wants to insert and ctrl- wants to delete?

    sorry shg the code stuff on that web site is greek to me, I wish it werent but it is.

    Trucker can you tell me how to put all that into my work sheet? I dl'd your sheet and it has the code "on" it but i dont know what to do with it.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Press and hold the Ctrl key, then press semicolon.

  6. #6
    Forum Contributor trucker10's Avatar
    Join Date
    07-22-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 / 2007 / 2010 prof +
    Posts
    149

    Re: Automatic Date insert

    Quote Originally Posted by tregrad View Post
    ctrl+ wants to insert and ctrl- wants to delete?

    sorry shg the code stuff on that web site is greek to me, I wish it werent but it is.

    Trucker can you tell me how to put all that into my work sheet? I dl'd your sheet and it has the code "on" it but i dont know what to do with it.
    Press Alt F11 and you can copy the code for your sheet

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Automatic Date insert

    Generally a good idea to disable events
    (one less call of the Worksheet Change event - adding the date stamp does not invoke the event...)

    Please Login or Register  to view this content.
    (change range to suit)
    Last edited by DonkeyOte; 09-24-2009 at 04:14 PM.

  8. #8
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    Quote Originally Posted by trucker10 View Post
    Press Alt F11 and you can copy the code for your sheet
    pressing f11 does it automatically?
    I pressed f11 and it came up with some funky screen about charts etc.
    im running 07 if thta makes a diff, sorry if i didnt mention it

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Adding Code to a Sheet module
    1. Copy the code from the post
    2. Right-click on the tab for the relevant sheet and select View Code. This opens the Visual Basic Editor (VBE) and shows the object module for the selected worksheet.
    3. Paste the code in the window
    4. Close the VBE to return to Excel

  10. #10
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    ok great shg,
    now which code is the better of the two? Donkey's or truckers, not trying to pit anyone up against the other, I really appreciate all the help but at the same time I want to be sure.

    thanks

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    They do the same thing. trucker's will retrigger the change event, which will exit because the cell modified by the code is not in the tested range -- no harm, no foul, but DO's is better practice. You need to change the range in DO's to be the correct range for your workbook.

  12. #12
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    I did what you said and I tested it in the first cell b3 and it worked, but, I deleted what i wrote in the cell b3 and then deleted the auto generated date and now it doesnt work at all
    Last edited by tregrad; 09-24-2009 at 08:58 PM.

  13. #13
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    how can i get this to work if i need to delete the initial entry in b3? or do i just have to leave everything alone after its entered?

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Step back, take a deep breath, and explain exactly and lucidly what behavior you want.

  15. #15
    Forum Contributor trucker10's Avatar
    Join Date
    07-22-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 / 2007 / 2010 prof +
    Posts
    149

    Re: Automatic Date insert

    Quote Originally Posted by tregrad View Post
    how can i get this to work if i need to delete the initial entry in b3? or do i just have to leave everything alone after its entered?
    see the posting in # 3 because it works

  16. #16
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    OK, breathing......

    very simply, I want the date to be automatically inserted into column A when i type something into bolumn B. If i have to delete whats in column B then column A should also be cleared out.

    I did try post #3 and I can seem to get anything to work. I put donkeys code into the sheet and it worked great, but i then deleted what I input into column B and had to delete what was automatically input to column A and I havent been able to re-paste that code into the work sheet and get it to work?
    However this is all irrelevant if we can get it working as i explained earlier.

    Again,
    Thanks for all your help
    Attached Files Attached Files

  17. #17
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Try this:
    Please Login or Register  to view this content.
    Last edited by shg; 09-26-2009 at 08:17 PM. Reason: add UsedRange to Intersect

  18. #18
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    its not working?

    I right click on the sheet "job schedule" and click on "view source" then paste the code that you posted into the window within the VBA and then close the VBA, am i doing it right?

    is teh workbook or sheet not allowing it to work for some reason? because it worked the first time untill i deleted the test input.

  19. #19
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Some of the other code may have left events disable. Save, close, and reopen the workbook, and try again.

    If it still doesn't work, post the workbook.

    EDIT: I made a change to the prior code to accommodate the case where you delete the whole column. Grab that.
    Last edited by shg; 09-26-2009 at 08:18 PM.

  20. #20
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    I may have mis spoke, here was what i said originally

    "very simply, I want the date to be automatically inserted into column A when i type something into bolumn B. If i have to delete whats in column B then column A should also be cleared out."

    I meant to say if I type something into column B cell 5 then column A cell 5 will automatically have the date inserted. conversley, if I delete the contents of column B cell 5 then the contents of column A cell 5 should also be deleted .

    how do i disable?

    My apologies for not being complete in my description

  21. #21
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    What you described is what the code does ... enter something in B5, A5 gets the date. Clear B5, A5 gets cleared. That's not what you're seeing?

    how do i disable?
    You mean stop the whole behavior?

  22. #22
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    this is what you said: "Some of the other code may have left events disable. Save, close, and reopen the workbook, and try again."

    I dont know what you mean by "left events disable"

    it seems as though the sheet dosent want to accept any code or something like that.

  23. #23
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    I am totally lost.
    dont know what you mean by "left events disable[d]"
    If some code disables events ...
    Please Login or Register  to view this content.
    ... and then is interrupted before executing this line:
    Please Login or Register  to view this content.
    ... then no events will fire until the workbook is closed and reopened.

    Meanwhile, back in Texas, I have no clue what you're seeing.

  24. #24
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Automatic Date insert

    This thread has hurt me deeply.

    In the interest of clarity rather than "better" ideas:

    Close workbook
    Close excel
    Open workbook
    right-click "Job Schedule" tab -> view code
    Cursor in 'main' window of that view
    Ctrl+A
    Delete
    Now paste this:
    Please Login or Register  to view this content.
    Close that
    Try it
    ...
    profit!

  25. #25
    Forum Contributor trucker10's Avatar
    Join Date
    07-22-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 / 2007 / 2010 prof +
    Posts
    149

    Re: Automatic Date insert

    with the new code from post #17 works well , good job shg
    Charlie , I think you are tired , just rest and then start again .
    the code does perfectly what to do, put the date , and if you delete the cell in column b the remove ( empty cell in column A )
    Attached Files Attached Files

  26. #26
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    Quote Originally Posted by CC
    This thread has hurt me deeply.
    Have you been WOUNDED, Charlie?? What can we do to HELP??


  27. #27
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Automatic Date insert


    We really should make a standard examples subsection, I see "I need timestamps" about once a week... normally it doesn't take two pages!

  28. #28
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Talking Re: Automatic Date insert

    Charlie your code worked awesome, I dont know if its different from the others or not but I did everything exactly as others said to do throughout this 2 page thread but they didnt work. the only thing i did different in this case is the "ctrl A" then "delete" (all from KB not mouse)

    Charlie sorry about the mental anguish this has put you through and i sure hope you havent lost any sleep over this and your family is safe. I know a very good shrink, being in the tile business it is necessary when dealing with rich snooty home owners.

    Any of you guys need any expert advice on tile or granite I will be very happy to help you, just email me. as you know I will not be able to help you with excell code.

  29. #29
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Automatic Date insert

    All's well that ends well. Thanks, CC.

  30. #30
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Automatic Date insert

    The tail end of this thread has filled me with warm, fuzzy feelings, piqued by the sarcasm of witty moderators...

  31. #31
    Forum Contributor
    Join Date
    01-01-2006
    Posts
    122

    Re: Automatic Date insert

    How do i make the macros stay enabled? I opened this workbook today and it didnt work, only now i know why. I didnt dare ruin CC's warm fuzziness, I couldnt bring myself to ruin his day after all the help yall gave me.

    does excell automatically disable macros everytime you open a workbook or is there a setting that will keep macros enabled for for certain WB's.

    never mind I figured it out (trust center) All is not lost though. this would be a good first question to ask when confronted with macros by dummies like myself.
    No point in replacing the whole engine when an air filter replacement will do the trick eh?

    Anyway, you guys are awesome and I really appreciate your patience with me.

  32. #32
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: Automatic Date insert

    Thanks DO, very helpful answer

+ 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