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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top