Hi,
I realise my last question was probably not specific enough.
How do I iterate through every row in a worksheet without knowing how many rows there could be?
Also how do I delete a whole row?
Thanks,
:Ant
Printable View
Hi,
I realise my last question was probably not specific enough.
How do I iterate through every row in a worksheet without knowing how many rows there could be?
Also how do I delete a whole row?
Thanks,
:Ant
or something like that - type it in and press f1 - should be some information on deleting.Code:Rows(num).Delete
Either that or use a range/cell object...
Again look in the help files to clarify.Code:sht.cells(1,1).DeleteRow
Alternatively record a macro of you deleting a row and see what the code is.
As to the how many rows. You could move up from the bottom to see when a key field (that is always filled) in your data is and grab the row number.
Hope that gives you some ideas.Code:debug.print sht.cells(65535,1).end(xlup).row