View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
animal1881[_3_] animal1881[_3_] is offline
external usenet poster
 
Posts: 1
Default How do I use VBA to add a formula?

The problem with both solutions is that this macro is, well
complicated.

Why use VBA? Worksheet formulae will do it

Yes, it can be easily done manually, the problem is that there is
very large number of these sheets that need to be evaluated, somewher
around 500. I have written the code to go through a directory and ge
all the files, open them one by one and extract the data I need, it'
just this final computation I cant get past.

Range(row1, column3).formulaR1C1="=R[0]C[-2]*R[0]C[-1]"

I considered this, but it doesnt not allow variables to be used for th
column names. There are 45 different columns. I am thinking I migh
need to change the order of them on the spreadsheet to suit my boss'
fickle tastes. If I were to change column 1 to column 5, then I woul
need to go back and re-write all the formulas

--
Message posted from http://www.ExcelForum.com