 Search:

# MS Office Forum

Ask Question   UnAnswered
RSS Feeds

# Formula using range name in VBA code

Asked By: Raynard    Date: Jan 03    Category: MS Office    Views: 4272

Could some one help me to translate this formula to VBA code?

My objective is to calculate the value inside the macro and putting the
results directly in the right columns.

Let's give an example:

In the columns "H" I have the following formula:

H11 =
(INDEX(CUSTOCAD,,MATCH((IF(ISERROR(FIND(".",\$E11)),\$E11,LEFT(\$E11,LEN(\$E11)-
2))),CAPDESPE,0))) : Formula 1

In the columns "I" I have the following formula:

I11 = IF(\$F11="USD",\$G11/TXCAMBIO, \$G11) : Formula 2

In the columns "J" I have the following formula:

J11 = (\$D11)*(100+\$H11+\$I11)/100 : Formula 3

CUSTOCAD, CAPDESPE and TXCAMBIO are range name.

I would like that the VBA code make the following:

Value1 = Formula 1

Cells(H11) = value1

Value2 = Formula 2

Cells(I11) = value2

Value3 = Formula 3

Cells(J11) = value3

How can I convert the Formula1, Formula2 and Formula3 in VBA code?

Share:

### 1 Answer Found

Answer #1    Answered By: Alejandro Smith     Answered On: Jan 03

By far the easiest way to do this is to paste the formula  into the cell,
cut and paste special / value back to the same cell. Record this
operation using the Macro Recorder and it will generate the code  for
you.

Didn't find what you were looking for? Find more on Formula using range name in VBA code Or get search suggestion and latest updates.

Tagged: