ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting rows based upon Error conditions (https://www.excelbanter.com/excel-programming/319690-deleting-rows-based-upon-error-conditions.html)

Jeff

Deleting rows based upon Error conditions
 
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

Bernie Deitrick

Deleting rows based upon Error conditions
 
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


"JEff" wrote in message
...
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





All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com