eurano
eurano

Reputation: 55

Count non blank cells in row x

What Im trying to achieve is to count non blank cells in row lRow. I got error on third line of the macro. I have no idea how to fix it.

Sub CountNonEmptyCells()

    lRow = Cells(Rows.Count, 1).End(xlUp).Row

    Rows(lRow).SpecialCells(xlCellTypeConstants, 23).Cells.Count
    MsgBox lRow

End Sub

Upvotes: 1

Views: 1385

Answers (1)

eurano
eurano

Reputation: 55

never mind, I fixed it myself:

Sub CountNonEmptyCells()

    lRow = Cells(Rows.Count, 1).End(xlUp).Row

    x = Rows(lRow).SpecialCells(xlCellTypeConstants, 23).Cells.Count
    MsgBox x

End Sub

Upvotes: 1

Related Questions