excel macro

when writing a macro, how do you find the last row of data if there are random blanks between rows? i’m sure this is easy.

Range(“IV1”).End(xlToLeft).Select for rows Range(“A65536”).End(xlup).Select for columns There’s an easier way to do it in newer versions I think.

look up “UsedRange” in the help file.

nolabird032 Wrote: ------------------------------------------------------- > when writing a macro, how do you find the last row > of data if there are random blanks between rows? > i’m sure this is easy. I’d use a while loop. Send me a messge if you want me to mock up the code. The “End()” function won’t account for the blanks…

http://vbaexpress.com/forum/showthread.php?t=9774 This article details several ways to go about it.

End works if there’s blanks. You just go from the last row (column) up (back). I’d have to see the actual sheet to be sure, but I’m pretty sure it would work. While loop is too much work.