View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wmureports wmureports is offline
external usenet poster
 
Posts: 14
Default Error when deleting rows

What i do is, I merge about 100 xls files into one master xls file.
But some records have empty rows that have to be deleted or they mess
up the formating. So i wrote some code but theres an issue. Heres a
part of the code:


Set mybook = Workbooks.Open(FNames)
'mybook.DisplayAlerts = False
lrow = LastRow(mybook.Sheets(1))
ActiveSheet.Range("C8:C" &
lrow).SpecialCells(xlCellTypeBlanks).EntireRow.Del ete
Set sourceRange = mybook.Worksheets(1).Range("A1:IV" &
lrow)
rnum = 1
SourceRcount = sourceRange.Rows.Count
Set destrange = basebook.Worksheets(1).Cells(rnum, "A")

sourceRange.Copy destrange

This does the job, it deletes the rows... BUT, when it comes to an XLS
file without any empty/blank rows, it generates an Error and stops
working. How would i make it do a check to see if theres actually
blank rows to begin with???

thanks in advance