View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Earl Kiosterud Earl Kiosterud is offline
external usenet poster
 
Posts: 611
Default Enter number in cell and have it divide by 4

Chey,

This will require an even-driven (Worksheet_Change) macro. You'll have to put in in the
workbook. Here's one that will divide anything in column B (column #2):

Private Sub Worksheet_Change(ByVal Target As Range)
Const ColumnNumber = 2
If Not Intersect(Target, Cells(1, ColumnNumber).EntireColumn) Is Nothing Then
On Error GoTo errr
If IsNumeric(Target.Value) Then
Application.EnableEvents = False
Target = Target / 4
Application.EnableEvents = True
End If
End If
End
errr:
Application.EnableEvents = True
MsgBox "Error: " & Err.Description
End Sub

It goes in the Sheet module for the sheet involved.

Or you can put your original value in, and have another cell with a formula that produces
the result you want:

=A2/4
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Chey" wrote in message
...
I have a cell that when I type the number for example 12 I want it to return 3
So the Number I type in divided by 4.
I have some other cells I am going to do with the number 8 and so on.
Thanks
Cheyenne