32CARDS
Board Regular
- Joined
- Jan 1, 2005
- Messages
- 123
Column A has listed items that are Accepted.
Column B has listed items that are not Accepted.
Column B is fixed set of items, but 1 or 2 new items from time to time may be added or deleted.
Column A though is a new updated daily list of items un-checked.
My current macro is a Do Until "" type of Loop to check if there are items to be deleted in Column A by reference to column B.
It then deletes that row.
Problem is, the macro is filling up with references as a new item is added.
----------------------------------
Sheets("Sorted").Select
Sheets: Sorted is Column A, this is where the daily items are updated
--------
Sheets("CONTROLS").Range("V1").
Sheets CONTROLS is where the not wanted items are listed, fixed and updated manually from time to time as required.
---------
Each time a new "not wanted" item is added to the list, I have to
make adjustments to the macro
ActiveCell.Value = Sheets("CONTROLS").Range("V2").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V3").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V4").Value Or _
and so on.
----------
Question
Is there a better way to have a macro so whenever new not wanted items are added or removed,
the macro does not have to be amended each and every time ?
Thanks
Column B has listed items that are not Accepted.
Column B is fixed set of items, but 1 or 2 new items from time to time may be added or deleted.
Column A though is a new updated daily list of items un-checked.
My current macro is a Do Until "" type of Loop to check if there are items to be deleted in Column A by reference to column B.
It then deletes that row.
Problem is, the macro is filling up with references as a new item is added.
Code:
Sub DelCustomRows2()
Sheets("Sorted").Select
[D3].Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = Sheets("CONTROLS").Range("V1").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V2").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V3").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V4").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V5").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V6").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V7").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V8").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V9").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V10").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V11").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V12").Value Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
DoEvents
Loop
DoEvents
[A2].Select
Application.ScreenUpdating = True
End Sub
Sheets("Sorted").Select
Sheets: Sorted is Column A, this is where the daily items are updated
--------
Sheets("CONTROLS").Range("V1").
Sheets CONTROLS is where the not wanted items are listed, fixed and updated manually from time to time as required.
---------
Each time a new "not wanted" item is added to the list, I have to
make adjustments to the macro
ActiveCell.Value = Sheets("CONTROLS").Range("V2").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V3").Value Or _
ActiveCell.Value = Sheets("CONTROLS").Range("V4").Value Or _
and so on.
----------
Question
Is there a better way to have a macro so whenever new not wanted items are added or removed,
the macro does not have to be amended each and every time ?
Thanks