M
Miree
I have sheet 1 and sheet 2, i need to write a code that perfoms the following
action
If the contents of cell in (sheet2 column B) does NOT appear in (sheet 2
column A) delete the line, all of the cells in question are numbers only.
I am learning macros as i go, i already have a few set up to delete based on
text box content that I understand, working from this would help me know what
I am doing.
Dim rng As Range
Dim i As Long
Set rng = ActiveSheet.Range(Cells(1, "DM"), Cells(Rows.Count, "DM").End(xlUp))
'Work backwards from bottom to top when deleting rows
With rng
For i = .Rows.Count To 1 Step -1
If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox10.Text)) = 0 Then
.Cells(i).EntireRow.Delete
End If
Next i
End With
All help much appreciated
Thank you
action
If the contents of cell in (sheet2 column B) does NOT appear in (sheet 2
column A) delete the line, all of the cells in question are numbers only.
I am learning macros as i go, i already have a few set up to delete based on
text box content that I understand, working from this would help me know what
I am doing.
Dim rng As Range
Dim i As Long
Set rng = ActiveSheet.Range(Cells(1, "DM"), Cells(Rows.Count, "DM").End(xlUp))
'Work backwards from bottom to top when deleting rows
With rng
For i = .Rows.Count To 1 Step -1
If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox10.Text)) = 0 Then
.Cells(i).EntireRow.Delete
End If
Next i
End With
All help much appreciated
Thank you