Placing a formula into a cell through VBA code

M

Michelle Hillard

Hi guys,

I have one worksheet with 5 columns

Starting at rowA2, if cell A2 has text/a value, I would like the cell E2 to
auto enter =DATEDIF(B2,C2,"d). If A2 is blank, to input no formula in E2 so
that E2 has no value at all.
If cell A3 has text/a value, I would like the cell E3 to auto enter
=DATEDIF(B3,C3,"d). If A3 is blank, to input no formula in E3, so on an so
on.

I dont want to manually place the formula in either col A or col E to get
this result and simply fill the whole column with this formula, because if I
do, I have set it up so that column E sorts the rows by col E's values, so
if the cell in col E has a value of "0", all those rows with "0" in col E
are sorted above rows that have a value of 1, 2, anything higher.

Any help would be greatly appreciated.


--


---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com
 

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

Top