Forum Discussion

Harry1605's avatar
Harry1605
Copper Contributor
Aug 20, 2022
Solved

Populate Group Details

Hello,   I have a table with 3,216 columns starting from row 4 it goes down to row 40.  The odd number columns hold email addresses, the even number columns are blank but on row 3 they have a group...
  • HansVogelaar's avatar
    Aug 20, 2022

    Harry1605 

    Run this macro:

    Sub FillGroup()
        Dim c As Long
        Dim n As Long
        Dim m As Long
        Application.ScreenUpdating = False
        n = Cells(3, Columns.Count).End(xlToLeft).Column
        For c = 2 To n Step 2
            m = Cells(Rows.Count, c - 1).End(xlUp).Row
            Cells(4, c).Resize(m - 3).Value = Cells(3, c).Value
        Next c
        Application.ScreenUpdating = True
    End Sub

Resources