ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Auto Calculating in the same cell (https://www.excelbanter.com/excel-worksheet-functions/114178-auto-calculating-same-cell.html)

sbauman

Auto Calculating in the same cell
 
Is it possible to enter a number into a cell, have it multiplied by a
specified number, and the result automatically placed in the same cell?

Carim

Auto Calculating in the same cell
 
Hi,

Something along these lines :

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Set Target = Range("a1")
Target.Value = Target.Value * 3
Application.EnableEvents = True
End Sub


HTH
Carim


Carim

Auto Calculating in the same cell
 
Oops,

Forgot to restrict to range("A1")

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then
Exit Sub
Else
Application.EnableEvents = False
Target.Value = Target.Value * 3
Application.EnableEvents = True
End If
End Sub

Carim


Carim

Auto Calculating in the same cell
 
Oops,

Forgot to restrict area to range("A1")

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then
Exit Sub
Else
Application.EnableEvents = False
Target.Value = Target.Value * 3
Application.EnableEvents = True
End If
End Sub

Carim



All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com