ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copyinng & Renaming Worksheets (https://www.excelbanter.com/excel-programming/284429-copyinng-renaming-worksheets.html)

Ron McCormick[_2_]

Copyinng & Renaming Worksheets
 
I am wanting to copy a worksheet and then rename it with a
suffix that is a named range on the worksheet.

viz. something like
Sheets("Worksheet(2)").Name = "Worksheet ("& Region &")"
where region is thenamed range. What is the code required
for this.

TIA
Ron

Chip Pearson

Copyinng & Renaming Worksheets
 
Ron,

Where do you want to copy the worksheet to? The same workbook?
Try something like


Worksheets(2).Copy
ActiveSheet.Name = Range("Region").Text


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ron McCormick" wrote in message
...
I am wanting to copy a worksheet and then rename it with a
suffix that is a named range on the worksheet.

viz. something like
Sheets("Worksheet(2)").Name = "Worksheet ("& Region &")"
where region is thenamed range. What is the code required
for this.

TIA
Ron




Chip Pearson

Copyinng & Renaming Worksheets
 
Ron,

Disregard my previous reply. Use something like the following
instead.

With Worksheets
.Item(2).Copy after:=.Item(.Count)
End With
ActiveSheet.Name = Range("Region").Text


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Ron McCormick" wrote in message
...
I am wanting to copy a worksheet and then rename it with a
suffix that is a named range on the worksheet.

viz. something like
Sheets("Worksheet(2)").Name = "Worksheet ("& Region &")"
where region is thenamed range. What is the code required
for this.

TIA
Ron





All times are GMT +1. The time now is 07:21 PM.

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