Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Find & delete rows with ID's from another sheet.

I need a way to find & delete rows in sheet Billed that contain ClaimId
numbers. The ClaimID numbers that I need the rows deleted for, are listed
in a column of another sheet called VoidReq. Continuing down the VoidReq
sheet column until if finds an empty cell.

Hopefully its simple for someone
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Find & delete rows with ID's from another sheet.

Hi plys

This example loop through all cells in the C column of the activesheet
and delete the whole row if the value is in a sheet named "Sheet2" in the range A1:A20


Sub Example1()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1

With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1

If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf Not IsError(Application.Match(.Cells(Lrow, "C").Value, _
Sheets("Sheet2").Range("A1:A20"), 0)) Then .Rows(Lrow).Delete

End If
Next
End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub


More information here
http://www.rondebruin.nl/delete.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"plys" wrote in message ...
I need a way to find & delete rows in sheet Billed that contain ClaimId
numbers. The ClaimID numbers that I need the rows deleted for, are listed
in a column of another sheet called VoidReq. Continuing down the VoidReq
sheet column until if finds an empty cell.

Hopefully its simple for someone


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Find data from one sheet in another sheet [email protected] Excel Worksheet Functions 3 August 21st 06 07:08 PM
How can we delete rows permanently from excel sheet Nehal Shah Excel Discussion (Misc queries) 1 August 1st 05 01:58 PM
How do I find only the singular rows in a sheet with duplicates? Alli Excel Discussion (Misc queries) 2 May 4th 05 04:21 PM
Adding Rows to Master Sheet Excel Newbie New Users to Excel 1 December 23rd 04 10:56 PM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"