+ Reply to Thread
Results 1 to 16 of 16

picking system date,time with macro

  1. #1
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Question picking system date,time with macro

    Hi,

    I want to know how to pick the system data, time using macro function
    for each cell . if i make use =now() which is in format yyyy-mm-dd hh:mm:ss or after every entry it will providing current time, by erasing previous cells data also..
    but i should retain original data for previous cell also
    I enclosed the file with details and flow.
    please suggest how to resolve this issue..
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: picking system date,time with macro

    you can use = now(), then, before saving, select column, copy, paste special, values
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    Hi,

    If records are less we can use above method, like paste special values..
    originally we have 4500 to 5000 records. In that more than 250 records user may not entry the date, time field. only for few records he will entire. or user may take data from previous file and he may put in that current sheet, that tie above method will not holds good..
    so please suggest how to resolve this issue.

  4. #4
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    Hi,

    If records are less we can use above method, like paste special values..
    originally we have 4500 to 5000 records. In that more than 250 records user may not entry the date, time field. only for few records he will entire. or user may take data from previous file and he may put in that current sheet, that tie above method will not holds good..
    so please suggest how to resolve this issue.

  5. #5
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Question Re: picking system date,time with macro

    can any one suggest to resolve this issue.....
    Last edited by thara.p24; 08-16-2014 at 03:57 AM.

  6. #6
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    Hi,
    Can any one guide me to resolve this..

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: picking system date,time with macro

    Hi, thara.p24,

    you posted a workbook containing a lot of sheets but not making clear which sheet the code should work on (at least I could not get hold of it).

    Code goes into ThisWorkbook and should work for all sheets except the both mentioned:
    Please Login or Register  to view this content.
    You would need to save the workbook as macro enabled and would need to make sure that macros can be executed.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  8. #8
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Question Re: picking system date,time with macro

    Hi,

    I will go with step by step instruction. please refer this file.
    I want system date, time should be picked in that particular cell after each entry..
    so that after completing all data if the file is closed, and reopened to entry some data that time it should current system, date time in yyyy-mm-dd hh:mm:ss format..
    this has to be developed using macro...
    after running macro i should get required_output sheet...
    i enclosed the details...

    let me know if you required some more details...
    Thank you,
    Thara.
    Attached Files Attached Files

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: picking system date,time with macro

    Hi, thara.p24,

    I will go with step by step instruction.
    You would need to change the range in which the event is raised from Range("C:D") to Range("A:D") and maybe try the code in the first attachment and report what the code doesn´t do.

    Ciao,
    Holger

  10. #10
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    Hi,

    we are using MS Sql server as DATABASE, in that one table containing these columns, and we need to import data using excel with following conditions..
    customer_id,order_no are the primary key..
    we written macro to check this.. and getting proper output.
    but last column is creating a problem that an end user is not compulsory entering date time filed, at that time system has to generate a date.
    so that all entries will be in a format, then i will import that template in SQL , or else it is difficult to debug..
    try now i provided sample data, but originally we are having 5000+ records,


    table structure-->
    customer_id nvarchar(10)
    order_no nvarchar(10)
    price Quantity float
    Date_of_commencement datetime (in format like yyyy-mm-dd hh:mm:ss)

  11. #11
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: picking system date,time with macro

    Hi, Thara,

    I will only come back to this thread if I get an answer from you what the code I built on the attachment of the opening post (as that was the only available by that time) doesn´t do what you expect the code to do in exactly that workbook.

    Ciao,
    Holger

  12. #12
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    Hi,

    i enclosed the file..
    please see the script in the file, if i follow this method means every time i suppose to click on run button.
    so it refreshers, then time will update the Column E cell.
    is there any method such that, after entering data for 1st row -->A2,B2,C2,D2,
    when is comes to enter data for next row (A3 cell), then previous column E2 cell will get updated..
    so that column E is automated.

    Thanks
    Thara.
    Attached Files Attached Files
    Last edited by thara.p24; 08-16-2014 at 06:37 AM.

  13. #13
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    i included macro function in the file. please refer and suggest.

    Thank you.

  14. #14
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: picking system date,time with macro

    put this code in Sheet1 class module
    Please Login or Register  to view this content.
    valid for last attachment
    End Sub

  15. #15
    Registered User
    Join Date
    08-04-2014
    Location
    Mysore
    MS-Off Ver
    2007
    Posts
    35

    Re: picking system date,time with macro

    Hi,

    I putted this script in sheet1 but i need to click run button,
    it is not coming automated date,time when i am enter data for next cell..

  16. #16
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: picking system date,time with macro

    you did something wrong, see attached file
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro for System Date and time stamp
    By mangesh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-18-2013, 10:59 AM
  2. using Calendar form to store a date changes my system date/time
    By mslynng in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2009, 02:08 PM
  3. Change system date and time format
    By elcaris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2008, 03:34 PM
  4. system time and date
    By kdp145 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2006, 12:03 PM
  5. Display System Date and Time
    By Mikeice in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-23-2005, 09:45 AM

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