Replacing part of formula with its static value for multiple cells

thomassharp

Board Regular
Joined
Dec 10, 2014
Messages
84
Hi I've constructed a list of email formulas from email text values so i can use them with a VBA script. The problem I have is that I need to replace the end part of the formulas, the final cell reference, with it's static text value before I can use it. I know I can select the cell ref and press f9 which gives the exact result I need, but I have looked at the VBA for this by recording a macro and unfortunately it retains the text relative to each cell rather than the process. Example
Code:
Range("G9").Select
    ActiveCell.FormulaR1C1 = "=RC[-5]&"".""&RC[-4]&""@acme.com"""
    Range("G10").Select
   ActiveCell.FormulaR1C1 = "=RC[-5]&"".""&RC[-4]&""@Abccorp.com"""

For each cell it lists the individual text value relative to that cell and obviously they are all different so this won't work as a looped script

Is there a way that the the last cell reference can be made static with a range of cells?...
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Add these two lines and see if it helps

Selection.End(xlDown).Select
'Selects the last cell
Selection.Hyperlinks.Delete
'Removes the text as hyperlink

Also while recording your macro select Use Relative References

Assuming you are using Excel 2007+
 
Upvote 0
Wow that worked, solved. And it was simple - I created a terribly complicated formula to solve it yesterday:stickouttounge:. Your way was much easier.
 
Upvote 0
Not solved actually. It still takes he printed values and not the equivilant value in the range. It looked like it did as I hadn't set appropriate test values to clearly see the results..
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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