Deleting rows based upon Error conditions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to delete rows based upon catching the #REF! error. I am using
the following code;
Case CVErr(xlErrRef)
xlApp.Workbooks("CPCT Dec
CDART.xls").Worksheets(ShtRef).Rows(RowNdx, "H").Delete
I am deleting the row in the spreadsheet using the select case method to
trap the various types of errors. When it gets to the row in column "H", my
code breaks at the code listed above.

Any ideas?

JEff
 
Jeff,

"Rows" only takes a long index:

xlApp.Workbooks("CPCT Dec CDART.xls"). _
Worksheets(ShtRef).Rows(RowNdx).Delete

Otherwise, you would use the Cells property
xlApp.Workbooks("CPCT Dec
CDART.xls").Worksheets(ShtRef).Cells(RowNdx, "H").EntireRow.Delete

HTH,
Bernie
MS Excel MVP
 
Back
Top