Change month into date

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
838
Hi all, Kindly require to provide me support so that to create a VBA code, by which should change in col. "A" the format of mm/yyyy into dd/mm/yyyy.

e.g. 09/2018 should be 30/09/2018
10/2018 should be 31/10/2018

Thank you all in advance
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

nemmi69

Active Member
Joined
Mar 15, 2012
Messages
482
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Try this

Code:
Option Explicit
Dim LastRowNo As Long
Dim DayLoop As Long


Sub DaysInMonth()
LastRowNo = Sheets(1).Range("A1048576").End(xlUp).Row


For DayLoop = 1 To LastRowNo
    Sheets(1).Range("B" & DayLoop).Value = Format(Day(DateSerial(Year(Sheets(1).Range("A" & DayLoop).Value), Month(Sheets(1).Range("A" & DayLoop).Value) + 1, 1) - 1) & "/" & Month(Sheets(1).Range("A" & DayLoop).Value) & "/" & Year(Sheets(1).Range("A" & DayLoop).Value), "dd/mm/yyyy")
    
Next DayLoop


End Sub
 
Last edited:

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
838
Hi nemm, your code works perfect and based to my data! many thanks for your support. Hv a nice day
 

Watch MrExcel Video

Forum statistics

Threads
1,129,364
Messages
5,635,839
Members
416,885
Latest member
hs11

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
Top