I am looking for a imple formula for excel i need Cloumn be to
I didn't omit it. I move it down to right before the change
(.value = .value * 1.131)
In your original code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo endit
Application.EnableEvents = False
If Target.Count 1 Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
If Target.Cells.Column = 2 Then
With Target
.Value = .Value * 1.131
End With
End If
endit:
Application.EnableEvents = True
End Sub
You turn off the events right away.
If there are two cells that are changed (target.count 1), you exit the sub
without changing .enableevents back to true.
Same thing with the isnumeric() test.
You could have changed "exit sub" to "goto endit:" in both spots, but moving
that line was easier.
Gord Dibben wrote:
Thanks Dave
Not sure I understand, but will play with the revision to see why enablevents =
false should be omitted.
Gord
On Tue, 19 Dec 2006 18:03:03 -0600, Dave Peterson
wrote:
There would be a problem with the .enableevents setting if two cells got
changed:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo endit
If Target.Count 1 Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
If Target.Cells.Column = 2 Then
With Target
Application.EnableEvents = False
.Value = .Value * 1.131
End With
End If
endit:
Application.EnableEvents = True
End Sub
Gord Dibben wrote:
You would need event code to have that happen without formulas or helper cells.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo endit
Application.EnableEvents = False
If Target.Count 1 Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
If Target.Cells.Column = 2 Then
With Target
.Value = .Value * 1.131
End With
End If
endit:
Application.EnableEvents = True
End Sub
This is sheet event code. Right-click on the sheet tab and "View Code"
Copy/paste the above into that sheet module.
Enter a number in column B and it gets multiplied by 1.131
No formulas or helper cells.
Gord Dibben MS Excel MVP
On Tue, 19 Dec 2006 14:08:01 -0800, help wrote:
Hi no I had tried those two ways, but I know t here is a way I remeber
learning, i need wahtever number i enter into column B to always mutlpy by
1.131 and I need the cell to only showw the answer of the calculation
"RichardSchollar" wrote:
Hi
Two ways come to mind: type whatver multiple number in a cell, and copy
the cell and select column B and go EditPasteSpecialMultiply, or use
the following formaula in an adjacent column and copy down:
=B1*number
replace number with whatever.
Hope this helps!
Richard
help wrote:
Hi there, my brain has gone to mush but i need my column B to be mulitplied
by the same number
Gord Dibben MS Excel MVP
--
Dave Peterson
|