ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to programmatically access sheets in a workbook by code name (https://www.excelbanter.com/excel-programming/319573-how-programmatically-access-sheets-workbook-code-name.html)

Bing

How to programmatically access sheets in a workbook by code name
 
Hi Again

I want to be able to refer to worksheets in a workbook programmatically that
way i wont have to worry if endusers will change the name of the worksheet.

Right now i'm using : ThisWorkbook.Worksheets("Sheet"1), but if i "Sheet1"
has a code name of 'secret', how can i go about getting a Worksheet reference
using that code name?

Tim Williams

How to programmatically access sheets in a workbook by code name
 
dim s as worksheet
set s=secret

Or (better) just use "secret" directly as in:

secret.Activate

Tim.


"Bing" wrote in message
...
Hi Again

I want to be able to refer to worksheets in a workbook
programmatically that
way i wont have to worry if endusers will change the name of the
worksheet.

Right now i'm using : ThisWorkbook.Worksheets("Sheet"1), but if i
"Sheet1"
has a code name of 'secret', how can i go about getting a Worksheet
reference
using that code name?





All times are GMT +1. The time now is 01:56 PM.

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