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 Contributor Last seen December 27, 2022 - Oct 27, 2016 at 11:38 AM
        TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Contributor 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?
- Start up sound changer - Download - Customization
- Nfs most wanted 2005 crash on start ✓ - Video Games Forum
- Instagram account based in wrong country - Instagram Forum
- Excel conditional formatting based on date - Guide
- Start teamviewer with windows - Guide
1 response
                
        
                    TrowaD
    
        
                    Posts
            
                
            2921
                
                            Registration date
            Sunday September 12, 2010
                            Status
            Contributor
                            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
