Formula

  • Thread starter Thread starter Jrmy
  • Start date Start date
Yea I have no problem doing each cell. But I have like 200 cells to do and I
was wondering if i could highlight the whole row or before I put in the value
have it set up. Something like =A/12. but that doesn't work
 
You cannot format a cell to divide and entered number by 12

You can use a helper cell with a formula =A1/12 in B1 or event code to
divide when you enter the number.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A1:A10")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If IsNumeric(.Value) Then
.Value = .Value / 12
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that module.

Edit the range to suit then Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP
 
Is this a request for further assistance or just a declarative statement?

There is nothing wrong with the code.


Gord
 

Ask a Question

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.

Ask a Question

Back
Top