Using VBA for date formatting

dh1996

New Member
Joined
Feb 8, 2024
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hey again,

i'm trying to format some dates using vba, generally it's easy enough, i can take dd-mm-yyyy to dd-mmm, but sometimes things go over two dates, for example, dd/dd-mm-yyyy and i want to take it to dd/dd-mmm, but since it's not a 'real' date then i can't get it to work properly.

i'm using an import to another sheet, so the date on one sheet will be as an example - 18/19-03-2025, and i want that to become 18/19-March on another sheet.

any help is appreciated!
 
If you have "18-19-03-2025" in cell A1, this VBA code will return "18/19-March":
VBA Code:
Left(Range("A1"), 6) & Format(DateValue(Right(Range("A1"), 10)), "mmmm")
 
Upvote 0
Solution
If you have "18-19-03-2025" in cell A1, this VBA code will return "18/19-March":
VBA Code:
Left(Range("A1"), 6) & Format(DateValue(Right(Range("A1"), 10)), "mmmm")
i will give it a try now thanks! i had tried using left and mid but i got something wrong and kept receiving and error
 
Upvote 0

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