G
Guest
Hi,
I am trying to insert a formula into a cell and am having trouble. I am
substituting the variable 'sheetname' for 'Sheet1'.
Here's my code:
Sub AddToList(SheetName)
Dim LastusedrowinD As Long
'The Formula is =Cell("filename" ,'Sheet1'!$A$1)
With Sheets("Table")
LastusedrowinD = .Cells(.Rows.Count, "D").End(xlUp).Row
.cell("D" & LastusedrowinD).Value = _
"=Cell(" & "filename" & ",'" & SheetName & "'!$A$1)"
End With
End Sub
Any suggestions as to how I would add this formula into the cell?
Thanks.
I am trying to insert a formula into a cell and am having trouble. I am
substituting the variable 'sheetname' for 'Sheet1'.
Here's my code:
Sub AddToList(SheetName)
Dim LastusedrowinD As Long
'The Formula is =Cell("filename" ,'Sheet1'!$A$1)
With Sheets("Table")
LastusedrowinD = .Cells(.Rows.Count, "D").End(xlUp).Row
.cell("D" & LastusedrowinD).Value = _
"=Cell(" & "filename" & ",'" & SheetName & "'!$A$1)"
End With
End Sub
Any suggestions as to how I would add this formula into the cell?
Thanks.