What is the VBA to convert a cell to the Australian date format

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
1,186
What is the VBA to convert a cell to the Australian date format of dd/mm/yyyy?
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Scott T

Well-known Member
Joined
Dec 14, 2016
Messages
2,609
Office Version
365, 2016
Platform
Windows
Code:
Range("A1").NumberFormat = "dd/mm/yyyy"
 

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
1,186
How would I code in the change of the number format for a table column (A) instead of a range? This is a line of code I tried to write and put in the worksheet_open sub:

Code:
Worksheets("NPSS_quote_sheet").ListObjects("NPSS_quote").ListColumns(1).Range.NumberFormat = "dd/mm/yyyy"
Was I close?
 

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
1,186
I used the formula provided Scott, but it only converts the date once it is entered. By that I mean that I enter 1/23/19 (US format) into excel and it converts it to 23/1/19(Aus format). I want it to enter the date, 23/1/19 and for it to still be a date format as I have other cells that depend on it and they give me the #Value error if I try to enter the date as 23/1/19. If I enter the date as 1/23/19 it works fine but that's not what I want.
 

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Hello,

From what you are saying, you should close Excel and check your Windows Regional settings ... which are in fact used by all Office Applications ... :)

Hope this will help
 

Forum statistics

Threads
1,089,487
Messages
5,408,554
Members
403,215
Latest member
DblDocWhitaker

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top