View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Formula building code : what's wrong with this little sub?

Do all cells in the offset range contain a value. If not sure change the
last bit to

& val(c.Offset(0, -14).Value)

Regards,
Peter T



wrote in message
...
Hello,
I have a table that is supposed to show the change in another
(parallel) table after changing inputs in a simulation model.
Can you figure what 's wrong with the code below?

Sub Macro3()
Dim c As Range
For Each c In Range("P44:Z54").Cells
c.Formula = "=" & c.Offset(0, -14).Address(0, 0) & "-" & c.Offset(0,
-14).Value
Next c
End Sub

Thank you very much for your remarks !!
Herman