I have excel template file which is excel 2016 , I want from Column E23 to E100 if some one enter any value it round off till 3 digit . Example :- 12345.123456 should convert to 12345.123 .
Bu this should only effective to that cell where any value get change . In attached picture Column E is where I want round off . Any help will be greatly appreciated .
Try this:
To enter this event-triggered Macro, right click on the sheet tab. Select "View Code" from the right-click drop-down menu. Then paste the code below into the window that opens.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range
If Not Intersect(Target, Columns(5)) Is Nothing Then
Application.EnableEvents = False
For Each C In Intersect(Target, Columns(5))
If IsNumeric(C.Value) And Len(C.Value) > 0 Then
C.Value = Round(C.Value, 3)
End If
Next C
End If
Application.EnableEvents = True
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.