Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I am using the ROUNDUP(A1,-1) formula to round up to the next ten of the value entered by a user into A1 i.e. 317.2 rounds up to 320. Is it possible to automatically round up to the next 10 the value the user enters into A1 i.e. automatically change from 317.2 to 320 once the user presses Enter or clicks off the cell. Thanks in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Put this in your worksheet code module: Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Range("A1") If Not Intersect(.Cells, Target) Is Nothing Then If IsNumeric(.Value) Then On Error Resume Next Application.EnableEvents = False .Value = Application.RoundUp(.Value, -1) Application.EnableEvents = True On Error GoTo 0 End If End If End With End Sub In article , Maddoktor wrote: Hi all, I am using the ROUNDUP(A1,-1) formula to round up to the next ten of the value entered by a user into A1 i.e. 317.2 rounds up to 320. Is it possible to automatically round up to the next 10 the value the user enters into A1 i.e. automatically change from 317.2 to 320 once the user presses Enter or clicks off the cell. Thanks in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you. Exactly what I was looking for.
JE McGimpsey wrote: One way: Put this in your worksheet code module: Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Range("A1") If Not Intersect(.Cells, Target) Is Nothing Then If IsNumeric(.Value) Then On Error Resume Next Application.EnableEvents = False .Value = Application.RoundUp(.Value, -1) Application.EnableEvents = True On Error GoTo 0 End If End If End With End Sub In article , Maddoktor wrote: Hi all, I am using the ROUNDUP(A1,-1) formula to round up to the next ten of the value entered by a user into A1 i.e. 317.2 rounds up to 320. Is it possible to automatically round up to the next 10 the value the user enters into A1 i.e. automatically change from 317.2 to 320 once the user presses Enter or clicks off the cell. Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Rounding up to the nearest 1/8" | Excel Discussion (Misc queries) | |||
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! | Excel Discussion (Misc queries) | |||
Can I enter a "Y" and return "Yes" in the same cell? PART 2 | Excel Programming | |||
Rounding up to the nearest 6" increment | Excel Programming |