Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Edit Text in Formula

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Edit Text in Formula

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Edit Text in Formula

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Edit Text in Formula

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to edit text in colum Michelle22 New Users to Excel 3 March 27th 09 07:55 PM
Edit text into one cell? pvdm Setting up and Configuration of Excel 1 March 21st 07 09:25 PM
Edit text of formula achidsey Excel Programming 3 September 22nd 05 02:36 AM
Edit Text Import Jim Link Excel Programming 0 August 19th 04 10:09 PM
Edit Text in Button ianripping[_32_] Excel Programming 6 February 7th 04 11:37 AM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"