format Date VBA

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,075
Office Version
  1. 2019
Platform
  1. Windows
I want to format the date output as "mm/dd/yy", however the code is not accomplishing what I want

Original code output display show 1/15/2019

Code:
Cells(SRow, 22) = Cells(RowNum, 3)

I tried this, but nothing happens. the output display show 1/15/2019

Code:
Cells(SRow, 22) = Format(Cells(RowNum, 3), "mm/dd/yy")

If i change the format to mmm/dd/yy, the output display show Jan/01,19.

Code:
Cells(SRow, 22) = Format(Cells(RowNum, 3), "mmm/dd/yy")

So clearly its doing something, just not want I want.

Can you help...thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,
Try

Code:
With Cells(sRow, 22)
    .Value = Cells(RowNum, 3).Value
     .NumberFormat = "mm/dd/yy"
End With

Dave
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top