G
Guest
Is it possible to add a constraint that will round the Changed cell to the nearest 5?
Thanks
AJ
Thanks
AJ
AJ
you can use code, something like this:
'===================================================
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng, cl
Set rng = [a:b] 'change with the desired range to be
affected
If Intersect(Target, rng) Is Nothing Then Exit Sub
For Each cl In Target
If cl.Value <> "" Then
cl.Value = Application.WorksheetFunction.Ceiling
(cl.Value, 5)
End If
Next cl
End Sub
'===================================================
This should be pasted in the View Code area of the sheet
where you want the constraint...right click on the sheet
tan, select view code and paste the code above in the
white area.
the code will change any cell that changed on columns a
and b, it will replace the value to the next 5 up.
to change the range change the part where it says:
set rng = [a:b] <--- change that as needed...
Cheers
Juan
-----Original Message-----
Is it possible to add a constraint that will round the Changed cell to the nearest 5?
Thanks
AJ
.