Excel VBA - Copy only values of VBA formulas

cydmm

New Member
Joined
Oct 17, 2015
Messages
10
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
One way would be to add some code in at the end, to copy and paste the values.
 
Upvote 0
that's what I temporarily made but, I was wondering if there is a better, more elegant way.
 
Upvote 0

Forum statistics

Threads
1,217,410
Messages
6,136,460
Members
450,013
Latest member
k4kamal

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
Back
Top