rename worksheet

G

Guest

I want to rename a worksheet using a name in a cell - the problem is then how
to refer to that sheet on the codeeg:

Dim sname As String
sname = Range("A2")
Sheets("QUOTE").Name = sname
Range("B7").Select
ActiveCell.FormulaR1C1 = "=sname!R[-4]C[-2]"

etc.....

it renames the sheet but when it runs the last name it cant find sname - is
the problem my syntax?

Thanks,
 
B

Bob Phillips

You need to separate the sname variable from the fixed text

Dim sname As String
sname = Range("A2")
Sheets("QUOTE").Name = sname
Range("B7").FormulaR1C1 = "=" & sname & "!R[-4]C[-2]"
 

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

Top