Excel automation

[[excel]] [[VBA]] code to fill empty columns in big excel sheets

Sub FillColumnFIfAIsNotEmpty()
    Dim ws As Worksheet
    Set ws = ActiveSheet
    Dim lastRow As Long
    lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

    Dim i As Long
    For i = 1 To lastRow
        If Not IsEmpty(ws.Cells(i, 1).Value) Then
            ws.Cells(i, 6).Value = "ALLEN BRADLEY"
        End If
    Next i
End Sub

Last updated