ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   recognize a sheet (https://www.excelbanter.com/excel-programming/355016-recognize-sheet.html)

zerosleep[_3_]

recognize a sheet
 

I want to make a copy of the 1st sheet and then rename it.
the name of the sheet is always changing, anyway I can get
VB to select the sheet no matter what it's name is?

Sheets("sheet-x").Copy After:=Sheets(1)
Sheets("sheet-x (2)").Select
Sheets("sheet-x (2)").name = "sheet-y"


--
zerosleep
------------------------------------------------------------------------
zerosleep's Profile: http://www.excelforum.com/member.php...o&userid=17846
View this thread: http://www.excelforum.com/showthread...hreadid=518695


Bob Phillips[_6_]

recognize a sheet
 
Either use its index

Sheets(1).Copy After:=Sheets(1)

or its codename

Sheet1.Copy After:=Sheets(1)



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"zerosleep" wrote
in message ...

I want to make a copy of the 1st sheet and then rename it.
the name of the sheet is always changing, anyway I can get
VB to select the sheet no matter what it's name is?

Sheets("sheet-x").Copy After:=Sheets(1)
Sheets("sheet-x (2)").Select
Sheets("sheet-x (2)").name = "sheet-y"


--
zerosleep
------------------------------------------------------------------------
zerosleep's Profile:

http://www.excelforum.com/member.php...o&userid=17846
View this thread: http://www.excelforum.com/showthread...hreadid=518695




zerosleep[_4_]

recognize a sheet
 

beautiful!!!

thank you bob, I guess it was so simple I didn't even think of it.
all this time I would just change the sheet name to reflect the
macros...much easier now.

-zerosleep


--
zerosleep
------------------------------------------------------------------------
zerosleep's Profile: http://www.excelforum.com/member.php...o&userid=17846
View this thread: http://www.excelforum.com/showthread...hreadid=518695



All times are GMT +1. The time now is 09:18 AM.

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