Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
500 B
2
Indexable
Never
Sub SummarizeColumns()
    Dim lastRow As Long
    lastRow = ActiveSheet.Cells(Rows.Count, "Q").End(xlUp).Row
    Dim col As Long
    Dim startingCol As Long
    startingCol = 17 'Q column
    For col = startingCol To ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
        If Cells(1, col).Value = "VO" Then
            For i = 4 To lastRow
                Cells(i, "G").Value = Cells(i, "G").Value + Cells(i, col).Value
            Next i
        End If
    Next col
End Sub