If sheet 2 shows a specific number in column A, I want it to delete the row that in Sheet1 that has a matching number in column 3.
Please, advise the quickest way to look through multiple numbers in sheet2 and delete all matches in Sheet1.
If sheet 2 shows a specific number in column A, I want it to delete the row that in Sheet1 that has a matching number in column 3.
Please, advise the quickest way to look through multiple numbers in sheet2 and delete all matches in Sheet1.
Last edited by SamT; 05-25-2016 at 08:09 AM. Reason: Deleted Font Name Formatting
Loop thru the used cells in column A
Use iterative "Find" on Column C, Be sure to Set "From" = C1 and "Direction" to xlPrevious
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
Some data type assumptions made
Sub Macro1() Dim Crit() Dim Data As Range, cel As Range Dim r As Range Dim i As Long Set r = Sheets(2).Columns("A:A").SpecialCells(xlCellTypeConstants) ReDim Crit(r.Cells.Count - 1) For Each cel In r Crit(i) = Str(cel) i = i + 1 Next Set Data = Sheets(1).Columns("C:C").SpecialCells(xlCellTypeConstants) Data.AutoFilter Field:=1, Criteria1:=Crit, Operator:=xlFilterValues Data.SpecialCells(xlCellTypeVisible).EntireRow.Delete End Sub
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Many Thanks!