I'm trying to find the number of the first empty row in my sheet in the excel via vbscript. Can some one help me out how to do that? that's what I did:
With objSheet
iRow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
msgbox iRow
It's not working well if the sheet is empty. Thanks!
Your now modified (with xlup) script will return the last NON-empty row in the column; unless the column is empty in which case it will return a 1
. So if you want the first empty row, you need to add 1
.
unless the script returns a 1
. In that case, you need to check A1
to see if it is empty or not, and only add 1
if it is.