Macro to copy rows and populate month/year based on start date?
Closed
ekwacillin
Posts
1
Registration date
Wednesday October 26, 2016
Status
Member
Last seen
October 26, 2016
-
Oct 26, 2016 at 02:10 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Oct 27, 2016 at 11:38 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Oct 27, 2016 at 11:38 AM
Related:
- Macro to copy rows and populate month/year based on start date?
- How to start a listening party on spotify pc - Guide
- Start survey - Download - Horror
- Excel macro to create new sheet based on value in cells - Guide
- Start up sound changer - Download - Customization
- Start steam in big picture mode - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Oct 27, 2016 at 11:38 AM
Oct 27, 2016 at 11:38 AM
Hi ekwacillin,
With the following code, the source data is taken from column A and B and the result is placed in columns C and D:
Best regards,
Trowa
With the following code, the source data is taken from column A and B and the result is placed in columns C and D:
Sub RunMe() Dim x, mMonth As Integer For Each cell In Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row) mMonth = Month(cell) x = 0 Do Range("C" & Rows.Count).End(xlUp).Offset(1, 0) = cell.Offset(0, -1) Range("D" & Rows.Count).End(xlUp).Offset(1, 0) = Format(DateAdd("m", x, cell), "mmmm") & ", " & Format(cell, "yyyy") mMonth = mMonth + 1 x = x + 1 Loop Until mMonth > 12 And x > 1 Next cell End Sub
Best regards,
Trowa