Getting new empty row ?
This function should do that for you...
Function FirstEmptyRow(Col As Variant) As Long
Dim Blanks As Range
If Cells(1, Col).Formula = "" Then
FirstEmptyRow = 1
Else
On Error GoTo NoInternalBlanks
FirstEmptyRow = Columns(Col).SpecialCells(xlCellTypeBlanks)(1).Row
End If
Exit Function
NoInternalBlanks:
FirstEmptyRow = Cells(Rows.Count, Col).End(xlUp).Row + 1
End Function
Just call it from your own code and pass it the column number or letter (in
quotes). For example...
Sub YourMacro()
MsgBox "First empty row in Column "G" = " & FirstEmptyRow("G")
End Sub
NOTE: This function does NOT consider a cell with a formula that is
displaying nothing ("") to be blank.
Rick
"kleysonr" wrote in message
...
How can i get the number of the first empty row in a column ?
|