Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have 2 columns (A & B) of text data, and I want to delete every row where the same term appears in both columns. So... for each row (n), delete the row only if An and Bn match. Any help much appreciated. Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 15 Aug, 15:52, Del_F wrote:
Hi, I have 2 columns (A & B) of text data, and I want to delete every row where the same term appears in both columns. So... for each row (n), delete the row only if An and Bn match. Any help much appreciated. Thanks. Okay, I figured it out, using some previously posted code: Sub Redundancy() Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 2 Step -1 If Not IsError(Application.Match(Cells(i, "A").Value, _ Range("B:B"), 0)) Then Cells(i, "A").Delete Shift:=xlUp End If Next i End Sub D. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test2()
RowCount = 1 Do While Not IsEmpty(Cells(RowCount, "A")) If Cells(RowCount, "A") = Cells(RowCount, "B") Then Cells(RowCount, "A").EntireRow.Delete Else RowCount = RowCount + 1 End If Loop End Sub "Del_F" wrote: Hi, I have 2 columns (A & B) of text data, and I want to delete every row where the same term appears in both columns. So... for each row (n), delete the row only if An and Bn match. Any help much appreciated. Thanks. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Joel,
Nice solution - works perfectly! D. On 15 Aug, 16:40, Joel wrote: Sub test2() RowCount = 1 Do While Not IsEmpty(Cells(RowCount, "A")) If Cells(RowCount, "A") = Cells(RowCount, "B") Then Cells(RowCount, "A").EntireRow.Delete Else RowCount = RowCount + 1 End If Loop End Sub "Del_F" wrote: Hi, I have 2 columns (A & B) of text data, and I want to delete every row where the same term appears in both columns. So... for each row (n), delete the row only if An and Bn match. Any help much appreciated. Thanks.- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete rows where colums 4 is empty | Excel Programming | |||
delete blank rows & colums | Excel Discussion (Misc queries) | |||
Delete rows that do not match criteria | Excel Programming | |||
VB Delete rows that do not match criteria | Excel Programming | |||
how do I delete all rows that match a condition? | Excel Worksheet Functions |