Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All,
Using MS Excel 2002 I am trying to compare data in column A in sheet A with column A in Sheet B. For every match I want to delete the entire row in Sheet B. The code I wrote is as below i = 2 'Start of loop Sheets("A").Select store = Range("B" & i) Sheets("B").Select 'Columns("A:A").Select --may not be needed Selection.Find(What:=store, After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False).Activate On Error GoTo ErrTrap ActiveCell.EntireRow.Delete '..some more code GoTo Finally Loop For a case when a cell in SheetA.ColumnA does not have a match in SheetB.ColumnA and error is generated which gets handled by the ErrTrap. This works fine for the first time a match is not found. The second time a match is not found excel gives a run time error - Run-time error '91': Object variable or With blck variable not set Can anyone tell what is wrong with the code. Thank you in advance. Regards, Rahul |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find last cell in a column, Delete its contents and make it active | Excel Worksheet Functions | |||
Find last cell in a column, Delete its contents and make it ac | Excel Worksheet Functions | |||
FInd common data in one column then add number in adjacent column | Excel Worksheet Functions | |||
how to find the data after we delete | Excel Discussion (Misc queries) | |||
macro to find something in column A and delete 5 rows below it | Excel Programming |