View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Formula in Range

Sub tryme()
x = Selection.Offset(0, -1)
y = Selection.Offset(0, -2)
Selection.Value = x - y
End Sub


or do you want a formula?
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Exceller" wrote in message
...
I've checked the forum for posts relating to this solution but didn't find
any. I'm looking for code that would enter a simple variance formula
against
two columns for as many values as there are in the two columns.

So, if I have in cell B5 a value of 200 and in cell C5 a value of 100,
then
the value in C5 would be 100 (simple subtraction of values in column C
from
values in column B). The condition is that the formula works for any two
columns preceding the cell that is selected. So, if cell F10 is selected,
for example, then the formula will begin in F10, subtracting E10 from D10,
on
down the F column for as many values as there are in columns D and E.

Is this do-able? Thanks.