Im ashamed to admit i cant figure this out. I have a bunch of data in the sheet and i want a macro to look for the first row with nothing in it and select it.
Im ashamed to admit i cant figure this out. I have a bunch of data in the sheet and i want a macro to look for the first row with nothing in it and select it.
Assuming there are no blanks mid data:
![]()
Range("A1").End(xlDown).Offset(1,0).Row
Or, safer, from the bottom:
![]()
Range("A" & Rows.Count).End(xlUp).Offset(1,0).Row
Regards
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
So I tried it and it tells me "invalid use of property"
Sub SelectNextEmptyRow()
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row
End Sub
Edit: please put your code in CODE Tags otherwise we'll both be in trouble from the Moderators.
You only asked how to get it, I guessed you knew what you were going to do with it ;-)
You need something like:
![]()
Sub SelectNextEmptyRow() Dim NextBlank as Long NextBlank = Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row ' Do something with the value you get ... Msgbox NextBlank End Sub
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks