have the following code, which works properly:
</PRE>
However, I want to use predefined constants to refer to the book and the sheet, instead of the actual names. So I want something like this, but it does not work (for simplicity some of my code is not included here).
</PRE>
So I want to use predefined references, instead of the actual book and sheet names. This code of course does not work. Can someone help me in making this code correct? Thanks!
HTML:
Sub hey()
With Workbooks(PosBook).Worksheets(PosSheet)
.Range("h5:h" & uff2).FormulaR1C1 = "='[Clearing position per entity (3).xls]Report1'!R[-1]C40"
End With
End Sub
</PRE>
However, I want to use predefined constants to refer to the book and the sheet, instead of the actual names. So I want something like this, but it does not work (for simplicity some of my code is not included here).
HTML:
Public Const ReportBook As String = "Clearing Position per entity (3)"
Public Const ReportSheet As String = "Report1"
Sub hey()
With Workbooks(PosBook).Worksheets(PosSheet)
.Range("h5:h" & uff2).FormulaR1C1 = _ "='[Reportbook]ReportSheet'!R[-1]C40"
End With
End Sub
</PRE>
So I want to use predefined references, instead of the actual book and sheet names. This code of course does not work. Can someone help me in making this code correct? Thanks!