+ Reply to Thread
Results 1 to 4 of 4

Printing Date Issues

  1. #1
    Registered User
    Join Date
    03-05-2019
    Location
    Sydney, Australia
    MS-Off Ver
    Office 2018
    Posts
    3

    Printing Date Issues

    So I am having issues with the excel/VBA giving dates in the US format (mm/dd/yyyy), even though all of my settings are set to Australian format (dd/mm/yyyy).

    Essentially I have an Input box for a date, and without any format changes, the input box displays the US date, but then when it is printed into a cell on the excel spreadsheet, it gives the Australian format. As an example, for 21st of March, it supplies:

    Input Box: 03/21/2019
    Prints in excel cell: 21/03/2019

    So I adjust the format of the Input Box to display the date in Australian format using:
    If Weekday(Date) = 6 Then
    dmy = Date + 3
    Else
    dmy = Date + 1
    End If

    del = Application.InputBox("Enter Delivery Date", TitleMsg, Format(dmy, "dd/mm/yy"))

    Ch.Cells(1, 10) = del
    This gives:

    Input Box: 21/03/2019
    Prints in excel cell: 03/21/2019

    So then, I tried correcting the printing of the excel date using:
    Ch.Cells(1, 10).NumberFormat = "mm/dd/yyyy"
    Ch.Cells(1, 10) = del
    Which does indeed give the correct date for both instances.

    Input Box: 04/03/2019
    Prints in excel cell: 04/03/2019

    But then in later code, when I try to use the date that has been printed, everything gets switched around again. So just wanted to see if anyone had a solution how to correct the original InputBox, because it seems that is just creates a domino effect the more I try to fix anything else.

    Thanks.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Printing Date Issues

    Try using CDate or DateValue.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-05-2019
    Location
    Sydney, Australia
    MS-Off Ver
    Office 2018
    Posts
    3

    Re: Printing Date Issues

    I tried the below...

    Please Login or Register  to view this content.
    Is this what you meant? Because it did not work, it still returned the date in Ch.Cells(1,10) in the US format.

    Thanks.

  4. #4
    Registered User
    Join Date
    03-05-2019
    Location
    Sydney, Australia
    MS-Off Ver
    Office 2018
    Posts
    3

    Re: Printing Date Issues

    Actually I managed to get your suggestion to work. It also sparked the realisation in me that maybe the actual Date formated to the cell was in the incorrect format. And it was, by changing the cell's format back to General, the Australian Date was displayed.

    Thanks.

+ 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. Printing issues
    By Sparkie in forum Excel General
    Replies: 2
    Last Post: 09-13-2017, 04:27 PM
  2. Excel to Outlook Calendar date duplication issues and blank cells causing issues
    By singerbatfink in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2016, 08:07 AM
  3. [SOLVED] Excel to Outlook Calendar date duplication issues and blank cells causing issues
    By singerbatfink in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 02-11-2016, 07:57 AM
  4. Printing issues...
    By Tuty in forum Excel General
    Replies: 0
    Last Post: 03-06-2009, 02:32 PM
  5. Printing issues
    By Bigredno8 in forum Excel General
    Replies: 3
    Last Post: 12-07-2008, 04:26 PM
  6. printing issues
    By gnvg8tor in forum Excel General
    Replies: 0
    Last Post: 08-30-2007, 09:22 AM
  7. Printing issues
    By Ivan De Weerdt in forum Excel General
    Replies: 2
    Last Post: 04-03-2006, 11: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