Macro to change date to mm/dd/yyyy when inputtting date in format dd/mm/yyyy

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have a macro to input dates in Cell P2 & P3 , which is in format dd/mm/yyy. I macro for the sheet "Inventory" to change the dates automatically to mm/dd/yyy once the date has been inputted


Code:
 Sub Date_Range()
With Sheets("Refloorplanned Payout")
that will change
Dim i As Date
 A = InputBox("Please Enter start date range e.g. 08/01/2020")

.Range("P2").Value = A

 B = InputBox("Please Enter end date e.g. 10/01/2020")

.Range("P3").Value = B


End With

End Sub


Your assistance is most appreciated
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Format the cells, where you are putting the date as mm/dd/yyyy
 
Upvote 0
Thanks for the advice. Did not realise how simple it was
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,391
Members
448,957
Latest member
Hat4Life

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