ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   rename worksheet (https://www.excelbanter.com/excel-programming/331723-rename-worksheet.html)

Ciara[_2_]

rename worksheet
 
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,

Bob Phillips[_7_]

rename worksheet
 
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]"


--
HTH

Bob Phillips

"Ciara" wrote in message
...
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,




Ciara[_2_]

rename worksheet
 
Thank you.


All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com