Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Subtract cell formula from existing cell formula
Does anybody has a macro which would deduct the cell formula of a
selection of cells from original formula. eg if cell A1= sum(b1:f1) the macro would leave formula in A1 as : sum(b1:f1) - sum(b1:f1) so that formula result of A1 would be zero |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Subtract cell formula from existing cell formula
Sub whybother()
Dim r As Range Dim s As String, s2 As String For Each r In Selection s = r.Formula s2 = WorksheetFunction.Substitute(s, "=", "") r.Formula = s & "-" & "(" & s2 & ")" Next End Sub -- Gary's Student " wrote: Does anybody has a macro which would deduct the cell formula of a selection of cells from original formula. eg if cell A1= sum(b1:f1) the macro would leave formula in A1 as : sum(b1:f1) - sum(b1:f1) so that formula result of A1 would be zero |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Subtract cell formula from existing cell formula
thxs - working great !!
Gary''s Student wrote: Sub whybother() Dim r As Range Dim s As String, s2 As String For Each r In Selection s = r.Formula s2 = WorksheetFunction.Substitute(s, "=", "") r.Formula = s & "-" & "(" & s2 & ")" Next End Sub -- Gary's Student " wrote: Does anybody has a macro which would deduct the cell formula of a selection of cells from original formula. eg if cell A1= sum(b1:f1) the macro would leave formula in A1 as : sum(b1:f1) - sum(b1:f1) so that formula result of A1 would be zero |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula to subtract values in one cell only... | Excel Worksheet Functions | |||
Formula to subtract values in one cell only... | Excel Worksheet Functions | |||
FORMULA; ADD A COLUMN, SUBTRACT 1 CELL, TAKE THE TOTAL X 10% | Excel Discussion (Misc queries) | |||
Excel: Add/subtract to existing value in same cell | Excel Worksheet Functions | |||
insert a new cell into an existing formula | Excel Discussion (Misc queries) |