+ Reply to Thread
Results 1 to 7 of 7

VBA Code (date format) should correspond with custom dateformat

  1. #1
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    115

    VBA Code (date format) should correspond with custom dateformat

    Good morning

    I have been trying for three weeks now to get this right but after watching videos and trying everything cant seem to get it to work.

    I have a file that when you type things in certain cells, it automatically creates a date stamp in cell "I"

    I then have a macro to copy the fields to another file that must be opened (I use a macro for that)

    then the file where everything copied must be saved with the new information and then uploaded to a website.

    the problem is that when it copies, the date changes to a number. I did watch various videos to make it correct but does not seem to work.

    So I am uploading three small excel files.

    Book2.xlsm is the file where you type in anything then it will generate a date stamp in cell "I"
    Results.xls (and it must not be a macro enabled file) is the one that must be uploaded. there is a macro on the sheet when u click it will copy the info over.

    make sure Results.xls is open before running the macro.

    When you copy the results over, it overrides the values and format in cell "I' and then the date shows as a number which gives an sql error when I upload it to a specific website.

    I am therefore also copying the file called "date file" so you can see what the correct format should be.


    What I am asking is can you not adjust the vba code is Book2 so that it can correspond with the format and value in date file?


    I removed sensitive information.


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Stona; 03-02-2020 at 05:40 AM.

  2. #2
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    115

    Re: Help me adjust this vba code

    here is the file with the correct date value format

    This is the error it is giving when the date shows as a "number" in the format General view

    Error while accessing the database
    Incorrect datetime value: '43886' for column 'Date_time' at row 1
    Attached Files Attached Files
    Last edited by Stona; 03-02-2020 at 03:28 AM.

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Help me adjust this vba code

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  4. #4
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    115

    Re: VBA Code (date format) should correspond with custom dateformat

    Good day.

    Thank you. I amended the thread title

  5. #5
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    115

    Re: VBA Code (date format) should correspond with custom dateformat

    Can someone please help????

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,309

    Re: VBA Code (date format) should correspond with custom dateformat

    Try this format

    Capture.JPG

  7. #7
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    115

    Re: VBA Code (date format) should correspond with custom dateformat

    I have created a date stamp in Excel. When u type cells b to h it will automatically insert today's date in cell I. When u right click on that date choose format, in the general tab it appears as a nr. 43886. I want it to appear as a date. Like the date format in the attached date file. I wanted to know if there is another vba code I can use to make it happen.

+ 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. Adjust code to fit a Mac computer
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2018, 11:54 PM
  2. [SOLVED] vba code to adjust round value at random
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2017, 07:52 AM
  3. help to adjust my macro code
    By Muhammad Waheed in forum Word Programming / VBA / Macros
    Replies: 4
    Last Post: 04-13-2016, 09:13 PM
  4. Can Someone Please Adjust This Code to Increase Speed?
    By smcmahon83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2015, 03:09 PM
  5. [SOLVED] Adjust code to run OnClick only
    By clarkyblade in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2015, 04:12 AM
  6. Adjust the code in the Web Query
    By win1980 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 11:21 PM
  7. Auto Adjust VBA Code
    By skankingpigeon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2012, 04:31 PM

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