Find first empty row

D

dave-rawlins

Hi all,

I don't really know about coding but I'm trying to get a data-entry
form to look for the first empty row based on Debra Dalgleish's coding
on Contextures. So far I have;

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
..End(x1Up).Offset(1, 0).Row

but when I try to run the userform I get "Run-time error 1004". I
don't know what this means but when I click on Debug the code above is
what is highlighted.

Any help would be much appreciated.

Dave
 
J

JMB

the 1 s/b l

iRow = ws.Cells(Rows.Count, 1) _
..End(xlUp).Offset(1, 0).Row

Also, Rows.Count is not qualified so it will refer to the active sheet,
which is fine as all worksheets have the same number of rows. If you have
chart sheets and one of those is the active sheet, you'll get an error.
Fully qualified, it would be ws.Rows.Count
 
D

dave-rawlins

Thanks JMB,
Works fine now. I feel such a fool at committing such a simple error
<blush> Sometimes you can get too close to a problem is my only excuse.


Dave
 
Top