Need help with FORMULAR1C1 property

  • Thread starter Thread starter John Wirt
  • Start date Start date
J

John Wirt

Why do I get a "Application or object-defined error" from ForumalRaC1
assignment?

Public Sub InsertLinkedTableTitle()
Dim RA As Range
Set RA = ActiveSheet.Range("A1")
RA.FormulaR1C1 = "='Table S' &'Title Page'!D2"
End Sub

"Table S" is a string value. 'Title Page' is the name of a sheet.

If FormulaR1C1 cannot handle a compounded string and cell link. how can I
assign such a formula to a cell?

Thanks.

John Wirt
 
How can 'Table S' be a string value? I've never seen a variable that
contained a space. To link variable data, and text data, you have to
seperate you quotes.

RA.FormulaR1C1 = "=" & TableS & "'Title Page'!D2"
 
My guess:

Option Explicit

Public Sub InsertLinkedTableTitle()
Dim RA As Range
Set RA = ActiveSheet.Range("A1")
RA.FormulaR1C1 = "=""Table S"" & 'Title Page'!r2c4"
End Sub

You could use .formula:

RA.Formula = "=""Table S"" & 'Title Page'!d2"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top