Fill blank cells (Variation)

前端 未结 2 1970
甜味超标
甜味超标 2020-12-12 07:28

I have an issue with filling blank cells of a column.

I have 3 Column headings in A, B, C.

Under that I have variable amounts of rows, but column A and B wil

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 08:08

    You might want to test for blanks before attempting to put formulas into cells that may not exist.

    With Columns(3).Resize(Cells(Rows.Count, 1).End(xlUp).Row, 1)
        If CBool(Application.CountBlank(.Cells)) Then
            ' For blank cells, set them to equal the cell above
            .Cells.SpecialCells(xlCellTypeBlanks).Formula = "=R[-1]C"
            'Convert the formula to a value
            .Value = .Value
        End If
    End With
    

提交回复
热议问题