Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Rounding up to nearest 10 when "Enter" is pressed or user has clickedoff the cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Rounding up to nearest 10 when "Enter" is pressed or user has clicked off the cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Rounding up to nearest 10 when "Enter" is pressed or user hasclicked off the cell

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Rounding up to the nearest 1/8" rudyeb Excel Discussion (Misc queries) 1 May 20th 08 07:09 PM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Can I enter a "Y" and return "Yes" in the same cell? PART 2 rbbbbeee Excel Programming 2 August 16th 06 12:20 PM
Rounding up to the nearest 6" increment GreenMonster[_2_] Excel Programming 4 July 20th 05 07:36 PM


All times are GMT +1. The time now is 03:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"