Option
Explicit
Sub
Test()
Dim
strPath
As
String
Dim
strFile
As
String
Dim
strFormula
As
String
strFile =
"abc.xlsx"
strPath = "D:\Folder\Subfolder\"
If
Right$(strPath, 1) <> "\" _
Then
strPath = strPath & "\"
strFormula =
"='%PATH%[%FILE%]korr'!RC"
strFormula = Replace$(strFormula,
"%PATH%"
, strPath, Compare:=vbBinaryCompare)
strFormula = Replace$(strFormula,
"%FILE%"
, strFile, Compare:=vbBinaryCompare)
ThisWorkbook.Worksheets(
"snt"
).Range(
"A1:B3"
).FormulaR1C1 = strFormula
End
Sub