Jason Campbell
Board Regular
- Joined
- Mar 22, 2016
- Messages
- 77
I am in the need of some assistance!
I need to evaluate all the cells that contain dates in column R, to the end of the range….however, I can expect that there will be dates missing, where the end users hasn’t input an ‘Agreed CR Due Date’. I have accounted for the empty cells in the if statements however, I need to construct a loop that will locate the last entry in column R, to make note of that cell reference and then proceed in checking cell by cell from column R4 down to the last column R entry cell reference already established.
Basically, I need to figure out the loop that I can encase my IF statements within… Based on the results of the IF statements, column T will be populated accordingly.
Below is an example spreadsheet layout and below it the code that have constructed so far, minus the loop part, which I can’t figure out… bit of a newbie!
Assistance will be kindly received!
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[TD]T[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Response to CIR[/TD]
[TD]Agreed CR Due Date[/TD]
[TD]CR Due Date[/TD]
[TD]CR Sent Date[/TD]
[TD]CRTime[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]CIR Bypassed![/TD]
[TD]N/A[/TD]
[TD]10-Mar-17[/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Withdrawn[/TD]
[TD][/TD]
[TD]Withdrawn at CIR[/TD]
[TD][/TD]
[TD]Wdrwn@CIR[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]CCN - Await Confirmation Notice[/TD]
[TD][/TD]
[TD]CCN[/TD]
[TD][/TD]
[TD]CCN[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Proceed CR Development - Due date agreed[/TD]
[TD]Input Agreed Date![/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Proceed CR Development - Due date NOT agreed[/TD]
[TD]Date Not Agreed![/TD]
[TD]02-Jun-17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I need to evaluate all the cells that contain dates in column R, to the end of the range….however, I can expect that there will be dates missing, where the end users hasn’t input an ‘Agreed CR Due Date’. I have accounted for the empty cells in the if statements however, I need to construct a loop that will locate the last entry in column R, to make note of that cell reference and then proceed in checking cell by cell from column R4 down to the last column R entry cell reference already established.
Basically, I need to figure out the loop that I can encase my IF statements within… Based on the results of the IF statements, column T will be populated accordingly.
Below is an example spreadsheet layout and below it the code that have constructed so far, minus the loop part, which I can’t figure out… bit of a newbie!
Assistance will be kindly received!
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[TD]T[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Response to CIR[/TD]
[TD]Agreed CR Due Date[/TD]
[TD]CR Due Date[/TD]
[TD]CR Sent Date[/TD]
[TD]CRTime[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]CIR Bypassed![/TD]
[TD]N/A[/TD]
[TD]10-Mar-17[/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Withdrawn[/TD]
[TD][/TD]
[TD]Withdrawn at CIR[/TD]
[TD][/TD]
[TD]Wdrwn@CIR[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]CCN - Await Confirmation Notice[/TD]
[TD][/TD]
[TD]CCN[/TD]
[TD][/TD]
[TD]CCN[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Proceed CR Development - Due date agreed[/TD]
[TD]Input Agreed Date![/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Proceed CR Development - Due date NOT agreed[/TD]
[TD]Date Not Agreed![/TD]
[TD]02-Jun-17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Code:
Range("R4").Activate
For
If ActiveCell.Value = "Withdrawn at CIR" Or ActiveCell.Value = "CCN" Or ActiveCell.Value = "" Then
ActiveCell.Offset(1, 0).Activate
ElseIf ActiveCell.Offset(0, 1).Value = "" And Date <= ActiveCell.Offset(0, 0).Value Then
ActiveCell.Offset(0, 2).Value = "CR to be sent?"
ActiveCell.Offset(1, 0).Activate
ElseIf ActiveCell.Offset(0, 1).Value = "" And Date > ActiveCell.Offset(0, 0).Value Then
ActiveCell.Offset(0, 2).Value = "X"
ActiveCell.Offset(1, 0).Activate
ElseIf ActiveCell.Offset(0, 1).Value <= ActiveCell.Offset(0, 0).Value Then
ActiveCell.Offset(0, 2).Value = "OK"
ActiveCell.Offset(1, 0).Activate
ElseIf ActiveCell.Offset(0, 1).Value > ActiveCell.Offset(0, 0).Value Then
ActiveCell.Offset(0, 2).Value = "X"
ActiveCell.Offset(1, 0).Activate
End If
Next