![]() |
Dividing input by a constant
Is there a way to create a formula or macro that when I enter a number in a
cell it will automatically divide 5.7? |
Dividing input by a constant
Hi,
Right click the sheet tab, View code and paste this in. Change the range to suit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub If Not Intersect(Target, Range("A1:A10")) Is Nothing Then' change to suit If IsNumeric(Target) Then On Error Resume Next Application.EnableEvents = False Target = Target / 5.7 Application.EnableEvents = True On Error GoTo 0 End If End If End Sub Mike "BabyBlueAXiD" wrote: Is there a way to create a formula or macro that when I enter a number in a cell it will automatically divide 5.7? |
Dividing input by a constant
THAT WORKS PERFECT!Thanks so much!
"Mike H" wrote: Hi, Right click the sheet tab, View code and paste this in. Change the range to suit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub If Not Intersect(Target, Range("A1:A10")) Is Nothing Then' change to suit If IsNumeric(Target) Then On Error Resume Next Application.EnableEvents = False Target = Target / 5.7 Application.EnableEvents = True On Error GoTo 0 End If End If End Sub Mike "BabyBlueAXiD" wrote: Is there a way to create a formula or macro that when I enter a number in a cell it will automatically divide 5.7? |
All times are GMT +1. The time now is 08:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com