Directly setting variable to formula

  • Thread starter Thread starter marston.gould
  • Start date Start date
M

marston.gould

Hi everyone -

I'm trying to figure out a more direct way of assigning a value that is
derived from a formula to a variable rather than having to place the
formula on the worksheet first.

Example:

I have a text item in cell A1 on a worksheet. I'm extracting a portion
of that text. Right now I'm doing this by assigning another cell to
this value using:

ActiveCell.FormulaR1C1 = "=LEFT(R1C1,FIND(""Accounts"",R1C1)-2)"
tVal = ActiveCell.Value

Is there someway to skip assigning a cell this formula and move the
value directly into tVal?

As a follow-up. Is there a quick way to load that tVal into each
location of a 1-D array of length n?

Thanks in advance

Marston
 
Try

Evaluate("=LEFT(A1,FIND(""Accounts"",A1)-2)")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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