FormulaR1C1 not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wrote a macro with the following script:

Range("B7").Select
ActiveCell.FormulaR1C1 = _
"=HYPERLINK(""c:/foldername/images/""&RC[-1]&"".jpg"",""Image"")"

This works on my machine but when I delivered it to the client, the macro
just copys the script into the cell and not the formula. In other words the
formula does not appear to be valid. It appears as RC[-1] and not A7.

Any ideas as to why this is happening and how I can fix it? If I go into
the actual spreadsheet and replace RC[-1] with A7 and copy that down, the
formula works. So the issue is with the RC[-1].

Any help would be greatly appreciated.

thanks
 
perhaps one of you needs to adjust
tools>options>general>uncheck/check r1c1
 
Matt,

Make sure that the cell is properly formatted - what you described happens if the cell if formatted
for text. You can do it this way:

With Range("B7")
..NumberFormat = "General"
..FormulaR1C1 = _
"=HYPERLINK(""c:/foldername/images/""&RC[-1]&"".jpg"",""Image"")"
End With

HTH,
Bernie
MS Excel MVP
 

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