Tidy VBA Code
Hi all,
I am not very experienced in writing vba.
I have got the following code, put together by recording macros
mostly, and editing afterwards.
Is there a simpler way to construct the below code.
Range("Q2").Select
Do While Not IsEmpty(ActiveCell.Offset(0, -1))
ActiveCell.FormulaR1C1 = _
"=IF(OR('Pallet'!RC[-1]<ShipmentDate_StartValue,'Pallet'!RC[-1]ShipmentDate_EndValue),""Del"",""Keep"")"
ActiveCell.Offset(1, 0).Select
Loop
Range("Q2").Select
Do While Not IsEmpty(ActiveCell.Offset(0, -1))
Do While ActiveCell = "Del"
ActiveCell.Offset(0, -16).Range("A1:Q1").Select
Selection.Delete Shift:=xlUp
ActiveCell.Offset(0, 16).Select
Loop
ActiveCell.Offset(1, 0).Select
Loop
ActiveSheet.Range("Q:Q").ClearContents
Data resides in column a to p
formula above check the data, populates column q, and acts on it
depending on value.
Cannot delete the whole row as data is on further columns (unable to
change this)
Thanks in advance
edul
|