ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem formatting date as "dd/mm/yyyy" (https://www.excelbanter.com/excel-programming/442289-problem-formatting-date-dd-mm-yyyy.html)

Raj[_2_]

Problem formatting date as "dd/mm/yyyy"
 
Hi,

I am formatting cells using the following code: sws1 is the source
sheet and dws is the destination sheet.

dws.Cells(datarow, 3) = Format(sws1.Cells(j, 6), "dd/mm/yyyy")

The value of "31-03-2010" in sws1 is displayed as "31-03-2010" in
dws and not as "31/03/2010" as desired. The cell in dws is formatted
as general

The value of "12-03-2010" in sws1 is displayed as "03-12-10" in dws
and not as "12/03/2010" The cell in dws is formatted as date.

The dates in the sws1 sheet are formatted as dates

Please help iwith the correct code formatting to display as desired.

Thanks in advance for the help.

Regards,
Raj

Jacob Skaria

Problem formatting date as "dd/mm/yyyy"
 
Try

dws.Cells(datarow, 3) = sws1.Cells(j, 6).Value
dws.Cells(datarow, 3).NumberFormat = "dd/mm/yyyy"

--
Jacob (MVP - Excel)


"Raj" wrote:

Hi,

I am formatting cells using the following code: sws1 is the source
sheet and dws is the destination sheet.

dws.Cells(datarow, 3) = Format(sws1.Cells(j, 6), "dd/mm/yyyy")

The value of "31-03-2010" in sws1 is displayed as "31-03-2010" in
dws and not as "31/03/2010" as desired. The cell in dws is formatted
as general

The value of "12-03-2010" in sws1 is displayed as "03-12-10" in dws
and not as "12/03/2010" The cell in dws is formatted as date.

The dates in the sws1 sheet are formatted as dates

Please help iwith the correct code formatting to display as desired.

Thanks in advance for the help.

Regards,
Raj
.


Usman

Problem formatting date as "dd/mm/yyyy"
 
Hi,

Raj please format the destination cell as "dd/mm/yyyy"

right click the cell, click on format cell, select custom in number tab,
then in the Type box please type "dd/mm/yyyy" press ok

Regards,

Usman

"Raj" wrote:

Hi,

I am formatting cells using the following code: sws1 is the source
sheet and dws is the destination sheet.

dws.Cells(datarow, 3) = Format(sws1.Cells(j, 6), "dd/mm/yyyy")

The value of "31-03-2010" in sws1 is displayed as "31-03-2010" in
dws and not as "31/03/2010" as desired. The cell in dws is formatted
as general

The value of "12-03-2010" in sws1 is displayed as "03-12-10" in dws
and not as "12/03/2010" The cell in dws is formatted as date.

The dates in the sws1 sheet are formatted as dates

Please help iwith the correct code formatting to display as desired.

Thanks in advance for the help.

Regards,
Raj
.



All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com