I am using VBA to apply the following formula into a Cell. I'd like to replace the reference to Cell G11
with a Long
that references the Row number of the ActiveCell. So instead of G11
it would be G55
if ActiveCell is on Row 55, or G27
if ActiveCell is on is Row 27.
Columns("A").Find("", Cells(Rows.Count, "A")).Offset(-1, 7).Formula = "=IF(G11=""Enter date"",""Don't edit cell"",TEXT(G11, ""dddd""))"
I did try this but got Object Defined Error:
Dim ActiveRowNumber As Long
ActiveRowNumber = ActiveCell.RowNumber
Columns("A").Find("", Cells(Rows.Count, "A")).Offset(-1, 7).Formula = "=IF(G11=""Enter date"",""Don't edit cell"",TEXT(""G"" & ActiveRowNumber, ""dddd""))"
range.formula = "=Sum(A1:A" & lastrow - 1 & ")"
is an example of using a variable in your inserted formula. Note the position of the Quotations and the Ampersands. – Cyril