Excel VBA - Copy only values of VBA formulas

cydmm

New Member
Joined
Oct 17, 2015
Messages
6
Hello everyone,
the following routine copies in each row of columns from A to E the correspondent Index+Match formula.
How can I change the code in order to have only the result of the formula in each cell, instead of the formula itself?

Thank you for any help

VBA Code:
Sub FormulaFill()
Dim LastRowColumnF As Long
Sheets("Report").Select
LastRowColumnF = Cells(Rows.Count, 6).End(xlUp).Row
Range("E5:E" & LastRowColumnF).Formula = "=INDEX(Tabella2[AGENT],MATCH('Report'!RC[1],Tabella2[Customer],0))"
Range("D5:D" & LastRowColumnF).Formula = "=INDEX(Tabella2[PROVINCE],MATCH('Report'!RC[2],Tabella2[Customer],0))"
Range("C5:C" & LastRowColumnF).Formula = "=INDEX(Tabella2[COUNTRY],MATCH('Report'!RC[3],Tabella2[Customer],0))"
Range("B5:B" & LastRowColumnF).Formula = "=INDEX(Tabella2[PHONE],MATCH('Report'!RC[4],Tabella2[Customer],0))"
Range("A5:A" & LastRowColumnF).Formula = "=INDEX(Tabella2[E-MAIL],MATCH('Report'!RC[5],Tabella2[Customer],0))"
End Sub
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

ChrisFoster

Board Regular
Joined
Jun 21, 2019
Messages
131
Office Version
  1. 365
Platform
  1. Windows
One way would be to add some code in at the end, to copy and paste the values.
 

cydmm

New Member
Joined
Oct 17, 2015
Messages
6
that's what I temporarily made but, I was wondering if there is a better, more elegant way.
 

Watch MrExcel Video

Forum statistics

Threads
1,128,114
Messages
5,628,783
Members
416,338
Latest member
Spartan5305

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top