M
Miree
I have the following code which works beautifully, I now need to modify or
write a new code to do the next step.
At the moment the code deletes the row if combobox5 does not appear in a
cell between AN and BF what I now need to do is If combobox5 does appear in
a cell I need to check that the cell 38 along (BZ to CR) has a number which
is between textbox1 and textbox2 if not delete the row
Dim rng As Range
Dim i As Long
Dim delrow As Boolean
Set rng = ActiveSheet.Range(Cells(1, "AN"), Cells(Rows.Count, "BF").End(xlUp))
rng.Select
With rng
For i = .Rows.Count To 1 Step -1
delrow = True
For j = 1 To .Columns.Count
If .Cells(i, j) = UserForm7.ComboBox5.Value Then
delrow = False
End If
Next j
If delrow = True Then .Cells(i, 1).EntireRow.Delete
Next i
End With
Any help much appreciated
write a new code to do the next step.
At the moment the code deletes the row if combobox5 does not appear in a
cell between AN and BF what I now need to do is If combobox5 does appear in
a cell I need to check that the cell 38 along (BZ to CR) has a number which
is between textbox1 and textbox2 if not delete the row
Dim rng As Range
Dim i As Long
Dim delrow As Boolean
Set rng = ActiveSheet.Range(Cells(1, "AN"), Cells(Rows.Count, "BF").End(xlUp))
rng.Select
With rng
For i = .Rows.Count To 1 Step -1
delrow = True
For j = 1 To .Columns.Count
If .Cells(i, j) = UserForm7.ComboBox5.Value Then
delrow = False
End If
Next j
If delrow = True Then .Cells(i, 1).EntireRow.Delete
Next i
End With
Any help much appreciated