PDA

View Full Version : Solved: Is there a Function in Excel to Determine the Row Length?



Saladsamurai
08-26-2009, 05:53 AM
That is, if we define the row length to be the last non-empty cell?

I have a Range of cells I want to loop through, but I only want to loop through from column 1 to the last non-empty column.

But there maybe empty columns scattered throughout the row.

Get my drift?

:dunno

mikerickson
08-26-2009, 06:00 AM
This will set LastCell to the last filled cell in row 1

Dim LastCell as Range, RowLength as Long

With Range("A1").EntireRow
Set LastCell = .Cells(1, .Columns.Count).End(xlToLeft)
End With

RowLength = LastCell.Column

Saladsamurai
08-26-2009, 06:24 AM
Great Thanks!! :hi: