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.
Enter this small macro in worksheet code:
Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range(quot;D1quot;), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Value = Target.Value 1.5
Application.EnableEvents = True
End SubRemember: worksheet code, not a module.
--
Gary's Studentquot;argonautquot; wrote:
gt; This is probably a question that has been brought up before, but I am trying
gt; to set up a cel that will contain a formula, BUT, that I can also enter a
gt; number in the cel and it will preform a caculation based on the formula. In
gt; other words, I want to set up D1 to be =D1 1.5, and when I enter 5 into D1,
gt; then 6.5 is what shows. Is this something I can do with a macro or vba? Any
gt; help is appreciated.
Is there a way to do it for an entire column, or multiple rows? I tried to
do it as a macro and for some reason it is not working properly.quot;Gary''s Studentquot; wrote:
gt; Enter this small macro in worksheet code:
gt;
gt; Sub Worksheet_Change(ByVal Target As Excel.Range)
gt; If Intersect(Range(quot;D1quot;), Target) Is Nothing Then Exit Sub
gt; Application.EnableEvents = False
gt; Target.Value = Target.Value 1.5
gt; Application.EnableEvents = True
gt; End Sub
gt;
gt;
gt; Remember: worksheet code, not a module.
gt; --
gt; Gary's Student
gt;
gt;
gt; quot;argonautquot; wrote:
gt;
gt; gt; This is probably a question that has been brought up before, but I am trying
gt; gt; to set up a cel that will contain a formula, BUT, that I can also enter a
gt; gt; number in the cel and it will preform a caculation based on the formula. In
gt; gt; other words, I want to set up D1 to be =D1 1.5, and when I enter 5 into D1,
gt; gt; then 6.5 is what shows. Is this something I can do with a macro or vba? Any
gt; gt; help is appreciated.
- Aug 14 Mon 2006 20:08
Entering numbers in a cel formula
close
全站熱搜
留言列表
發表留言