Inserting formula programatically

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

Guest

I want to give user access to modify formula through the user form. I am
taking formula from cell into the form by using:

txtH10 = Worksheets("c1").Cells(10, 8).FormulaLocal

After user's modification I want to reenter formula into the same cell. I am
trying to use:

Worksheets("SGE").Cells(10, 8).FormulaLocal = txtH10

Formula is entered but Excel does not see it as a formula. If I will go to
the cell manually, double click on it, and click on the green check it is
turning into formula and all is ok. But how to do it without this extra steps
? How to do it programatically ???

Thanks for help.

Tony
 
Tony,

Try

Worksheets("SGE").Cells(10, 8).FormulaLocal = txtH10.Text

BTW, FormulaLocal is a useless property. You can just use Formula.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Tony,
I would think you need something like;
Worksheets("SGE").Cells(10, 8).FormulaLocal = "=" & txtH10.Text
Depending what the user types, you may well get a wide variety of
errors/results. Validation would be desirable.

NickHK
 
Hi Bob,

Thank you very much for your help. Works exactly as I wanted it to be.

Regards,

Tony
 

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