Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel Experts,
I want to edit the formula in a cell by appending the existing formula with a minus sign and the value of another cell. My spreadsheet is similar to the following: A B 1 2 Current Position 3 AMD 200 (the formula in B3 is =200) 4 5 New Sells 6 AMD 100 The current code is similar to: Sub ProcessSell Set CurShares = Range("B3") Set TShares = Range("B6") End Sub The code I want to add should say, Edit the formula in CurShares by adding "-TShares" so that the formula in "B3" will change from "=200", to "=200-100" and the value of B3 will then be 100. Thanks, Alan -- achidsey |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Alan,
Range("B3").Formula = Range("B3").Formula & "-TShares" Or-- Range("CurShares ").Formula = Range("CurShares ").Formula & "-TShares" HTH, Bernie MS Excel MVP "achidsey" (notmorespam) wrote in message ... Excel Experts, I want to edit the formula in a cell by appending the existing formula with a minus sign and the value of another cell. My spreadsheet is similar to the following: A B 1 2 Current Position 3 AMD 200 (the formula in B3 is =200) 4 5 New Sells 6 AMD 100 The current code is similar to: Sub ProcessSell Set CurShares = Range("B3") Set TShares = Range("B6") End Sub The code I want to add should say, Edit the formula in CurShares by adding "-TShares" so that the formula in "B3" will change from "=200", to "=200-100" and the value of B3 will then be 100. Thanks, Alan -- achidsey |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Air-coded.
Range("B3").Formula = Range("B3").Formula & "-" & Range("B6").Value -- HTH Bob Phillips "achidsey" (notmorespam) wrote in message ... Excel Experts, I want to edit the formula in a cell by appending the existing formula with a minus sign and the value of another cell. My spreadsheet is similar to the following: A B 1 2 Current Position 3 AMD 200 (the formula in B3 is =200) 4 5 New Sells 6 AMD 100 The current code is similar to: Sub ProcessSell Set CurShares = Range("B3") Set TShares = Range("B6") End Sub The code I want to add should say, Edit the formula in CurShares by adding "-TShares" so that the formula in "B3" will change from "=200", to "=200-100" and the value of B3 will then be 100. Thanks, Alan -- achidsey |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bernie,
Thanks for your assistance. I edited it a bit and here's what I ended up with. Alan Sub Macro1() Set CurShares = Range("B3") CurShares.Select Set TShares = Range("B6") TShares.Select CurShares.Formula = CurShares.Formula & "-" & TShares.Value End Sub -- achidsey "Bernie Deitrick" wrote: Alan, Range("B3").Formula = Range("B3").Formula & "-TShares" Or-- Range("CurShares ").Formula = Range("CurShares ").Formula & "-TShares" HTH, Bernie MS Excel MVP "achidsey" (notmorespam) wrote in message ... Excel Experts, I want to edit the formula in a cell by appending the existing formula with a minus sign and the value of another cell. My spreadsheet is similar to the following: A B 1 2 Current Position 3 AMD 200 (the formula in B3 is =200) 4 5 New Sells 6 AMD 100 The current code is similar to: Sub ProcessSell Set CurShares = Range("B3") Set TShares = Range("B6") End Sub The code I want to add should say, Edit the formula in CurShares by adding "-TShares" so that the formula in "B3" will change from "=200", to "=200-100" and the value of B3 will then be 100. Thanks, Alan -- achidsey |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to edit text in colum | New Users to Excel | |||
Edit text into one cell? | Setting up and Configuration of Excel | |||
Edit text of formula | Excel Programming | |||
Edit Text Import | Excel Programming | |||
Edit Text in Button | Excel Programming |