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
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.