ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Renaming Worksheet (https://www.excelbanter.com/excel-programming/340311-renaming-worksheet.html)

LizW

Renaming Worksheet
 
Given 2 open spreadsheets - A and B. I copied Sheet1 from B to A using the
Move/Copy option at the tab level. It copied into A okay and renamed it
SearchResults 1 so that I can run a macro to rename to SearchResults. When I
run my macro to rename spreadsheet does not work .... if I just simply Copy
and Paste using the Edit menu and then rename to SearchResults 1 - then my
macro works. Here is the syntax...

ActiveWorkbook.Sheets("SearchResults 1").Select
Sheets("SearchResults 1").Name = "SearchResults"

Spelling was checked the first time it did not run.

--
LizW

Ron de Bruin

Renaming Worksheet
 
Maybe you have a extra space

You don't have to select it first

Sheets("SearchResults 1").Name = "SearchResults"

--
Regards Ron de Bruin
http://www.rondebruin.nl


"LizW" wrote in message ...
Given 2 open spreadsheets - A and B. I copied Sheet1 from B to A using the
Move/Copy option at the tab level. It copied into A okay and renamed it
SearchResults 1 so that I can run a macro to rename to SearchResults. When I
run my macro to rename spreadsheet does not work .... if I just simply Copy
and Paste using the Edit menu and then rename to SearchResults 1 - then my
macro works. Here is the syntax...

ActiveWorkbook.Sheets("SearchResults 1").Select
Sheets("SearchResults 1").Name = "SearchResults"

Spelling was checked the first time it did not run.

--
LizW





All times are GMT +1. The time now is 04:48 PM.

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