Formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,

I have this problem: I want to write a macro that is able to insert the same
formula in a given range of cells. The problem is that I have more than 200
files of data, each with more than 1000 rows of data, and need to insert a
formula in a given column in each of these files (for instance, not my case,
insert in C2=A2+B2; C3=A3+B3; etc...). My problem is not with the opening,
savin and closing of each file, but to insert the formula in each cell in
column C.

Thanks for any help.

Cheers,

Nuno
 
With ActiveWorkbook.Worksheets(1)
set rng = .Range(.Cells(2,"C"),.Cells(rows.count,"C").End(xlup))
rng.Formula = "=A2+B2"
End With

using relative references in the formula will allow excel to adjust the
formula in each row.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top