ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   accessing worksheets (https://www.excelbanter.com/excel-programming/315473-accessing-worksheets.html)

greg

accessing worksheets
 
Hello,

I have a question about referencing a specific sheet.

I see you can do this:

ThisWorkbook.Worksheets("MySpecialSheet").Select

Or

ThisWorkbook.Worksheets(2).Select

However, if the user changes the name of the sheet to "MySpecialSheet2" or
re-order the tabs you cannot use those.

I see there is a property CodeName. Which always has the default "Sheet<x"
name.

Can this be used?

Is there some other way to identify the sheet?



Thanks





Bob Phillips[_6_]

accessing worksheets
 
Yes you can use CodeName

Sheet2.Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"greg" wrote in message
...
Hello,

I have a question about referencing a specific sheet.

I see you can do this:

ThisWorkbook.Worksheets("MySpecialSheet").Select

Or

ThisWorkbook.Worksheets(2).Select

However, if the user changes the name of the sheet to "MySpecialSheet2" or
re-order the tabs you cannot use those.

I see there is a property CodeName. Which always has the default

"Sheet<x"
name.

Can this be used?

Is there some other way to identify the sheet?



Thanks







greg

accessing worksheets
 
thanks for the help


"Bob Phillips" wrote in message
...
Yes you can use CodeName

Sheet2.Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"greg" wrote in message
...
Hello,

I have a question about referencing a specific sheet.

I see you can do this:

ThisWorkbook.Worksheets("MySpecialSheet").Select

Or

ThisWorkbook.Worksheets(2).Select

However, if the user changes the name of the sheet to "MySpecialSheet2"

or
re-order the tabs you cannot use those.

I see there is a property CodeName. Which always has the default

"Sheet<x"
name.

Can this be used?

Is there some other way to identify the sheet?



Thanks










All times are GMT +1. The time now is 10:06 AM.

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