View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_887_] joel[_887_] is offline
external usenet poster
 
Posts: 1
Default Code to delete rows with varying amounts of data


do yo have a Header Row (Row 1) or some other row?

If you have a header row in row 1

'check if cell K2 is empty
if range("K2") < "" then
FirstRow = Range("K2").end(xldown).Row
LastrEmpty = FirstRow -1
rows("2:" & LastEmpty).delete
end if


If you don't have aheader row

'check if cell K1 is empty
if range("K1") < "" then
FirstRow = Range("K1").end(xldown).Row
LastrEmpty = FirstRow -1
rows("1:" & LastEmpty).delete
end if


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=195160

http://www.thecodecage.com/forumz