I would like to change the date format of a cell with VBA, but I have no idea for that. Let take below as our example, Column A is the input and Column B is the output as it must be in Thai Calendar...
My goal is extracting the value in Column A of Sheet1 to many Sheets with the converted Date...
Here is how you can copy data from cell 'A1' to 'B1' and convert date type to Thai.
Dim mydate As Date 'create date variable mydate = Range("A1").Value 'copy date value from Cell A1 Range("B1").Value = mydate 'paste date value into cell B1 Range("B1").NumberFormat = "[$-th-TH,107]d mmmm yyyy;@" 'convert copied format to Thai
Hope this answers your question.
sorry for that I have low rep to comment. date change is not a code issue. change from western date to buddadate is adding 543 yearsto western date as excel using the number for the date. 1 equals to 1900-01-01 2 equals to 1900-01-02 43752 equals to 2019-10-14
you need to add 543 years to western date put this on b1 cell.
=A1*1+543*365+rounddown(543/4,0)
remind that leap year comesevery 4 years so that you could adjust +rounddowns() part to correct date
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.