ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Entering numbers in a cel formula (https://www.excelbanter.com/excel-discussion-misc-queries/87483-entering-numbers-cel-formula.html)

lagiant

Entering numbers in a cel formula
 

This is probably a question that has been brought up before, but I am
trying
to set up a cel that will contain a formula, BUT, that I can also enter
a
number in the cel and it will preform a caculation based on the
formula. In
other words, I want to set up D1 to be =D1+1.5, and when I enter 5 into
D1,
then 6.5 is what shows. Is this something I can do with a macro or
vba? Any help is appreciated.


--
lagiant
------------------------------------------------------------------------
lagiant's Profile: http://www.excelforum.com/member.php...o&userid=34251
View this thread: http://www.excelforum.com/showthread...hreadid=540045


JimMay

Entering numbers in a cel formula
 
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Target.Value = Target.Value + 1.5
Application.EnableEvents = True
End Sub

HTH

"lagiant" wrote
in message :

This is probably a question that has been brought up before, but I am
trying
to set up a cel that will contain a formula, BUT, that I can also enter
a
number in the cel and it will preform a caculation based on the
formula. In
other words, I want to set up D1 to be =D1+1.5, and when I enter 5 into
D1,
then 6.5 is what shows. Is this something I can do with a macro or
vba? Any help is appreciated.


--
lagiant
------------------------------------------------------------------------
lagiant's Profile: http://www.excelforum.com/member.php...o&userid=34251
View this thread: http://www.excelforum.com/showthread...hreadid=540045



Gazeta

Entering numbers in a cel formula
 

Użytkownik "lagiant"
napisał w wiadomości
...

This is probably a question that has been brought up before, but I am
trying
to set up a cel that will contain a formula, BUT, that I can also enter
a
number in the cel and it will preform a caculation based on the
formula. In
other words, I want to set up D1 to be =D1+1.5, and when I enter 5 into
D1,
then 6.5 is what shows. Is this something I can do with a macro or
vba? Any help is appreciated.


--
lagiant
------------------------------------------------------------------------
lagiant's Profile:

http://www.excelforum.com/member.php...o&userid=34251
View this thread: http://www.excelforum.com/showthread...hreadid=540045


copy this sub into worksheet module
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$D$1" Then
Target.Value = Target.Value + 1.5
End If
End Sub
mcg




All times are GMT +1. The time now is 01:05 AM.

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