This sample code worked on my system:
Sub sample()
Dim LastRow1 As Integer, LastRow2 As Integer, PublicVariable As String
LastRow2 = 10
LastRow1 = 2
PublicVariable = "=(35*(5-H" & LastRow2 & "))-H" & LastRow1
Cells(2, 10).Formula = PublicVariable
End Sub




Reply With Quote