![]() |
auto divide option
Hi,
when i key in a cell with a number i want that to be divided by 40 Thanks Fernandez |
auto divide option
Right click the sheet tab, view code and paste this in. Works on the range A1
- A100 so change to suit. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Or Target.HasFormula Or IsEmpty(Target) Then Exit Sub If Not Intersect(Target, Range("A1:A100")) Is Nothing Then 'Change to suit If IsNumeric(Target) Then Application.EnableEvents = False Target = Target / 40 Application.EnableEvents = True On Error GoTo 0 End If End If End Sub Mike "Fernandez" wrote: Hi, when i key in a cell with a number i want that to be divided by 40 Thanks Fernandez |
auto divide option
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub If Target.Address = "$B$5" Then If Not IsNumeric(Target.Value) Then Exit Sub Application.EnableEvents = False With Target .Value = .Value / 40 Application.EnableEvents = True End With End If End Sub Right-click on the sheet tab and "View Code" Copy/paste the above into that module. Adjust the $B$5 to suit. You did not give enough information to tailor a specific cell or range of cells. For the entire sheet, just remove that line and the End If line. Alt + q to return to Excel. Gord Dibben MS Excel MVP On Tue, 19 Feb 2008 05:02:02 -0800, Fernandez wrote: Hi, when i key in a cell with a number i want that to be divided by 40 Thanks Fernandez |
All times are GMT +1. The time now is 04:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com