Convert Formula to Macro...

andyinla

New Member
Joined
Mar 19, 2009
Messages
10
I want to convert the formula below to a macro so there is not a file reference as listed in the formula.

=IF(ISBLANK(K626) = TRUE, "", VLOOKUP(CONCATENATE("", K626),'C:\Documents and Settings\ahaspel\Desktop\[Copy of Andrew Haspel (4).xls]Job Cost Detail Report 3'!$G$1:$K$1000,5,FALSE))

Any ideas of how?
 
I think if you turn on macro recorder then record entering your formula then when complete and entered do Ctrl+c with the cursor in the same cell. Then Alt e..s..v then stop you recorder. You should have a macro that fills a cell with the formula, then overwrites the formula with its current value.

Will that float your boat?
 
Last edited:
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Ok here is what I did for the macro:

ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(RC[-2]) = TRUE, """", VLOOKUP(CONCATENATE("""", RC[-2]),'C:\Documents and Settings\ahaspel\Desktop\[Copy of Andrew Haspel (4).xls]Job Cost Detail Report 3'!R1C7:R1000C11,5,FALSE))"
End Sub


Any suggestions to that?

Do I have to edit the macro when the source files changes?
I would imagine I do...
 
Upvote 0

Forum statistics

Threads
1,215,572
Messages
6,125,605
Members
449,238
Latest member
wcbyers

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