ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using sheet reference instead of name (https://www.excelbanter.com/excel-programming/431796-using-sheet-reference-instead-name.html)

Michelle

Using sheet reference instead of name
 
IN the VBE each sheet has a name that looks like "Sheet5(Data)"...
the sheet name is data, and I v=can refer to Sheets("Data"), How can I use
the sheet5 bit - the sheet's 'VB Name'?

Thanks

M


Jacob Skaria

Using sheet reference instead of name
 
Use the index number such as

Msgbox Sheets(5).name

If this post helps click Yes
---------------
Jacob Skaria


"Michelle" wrote:

IN the VBE each sheet has a name that looks like "Sheet5(Data)"...
the sheet name is data, and I v=can refer to Sheets("Data"), How can I use
the sheet5 bit - the sheet's 'VB Name'?

Thanks

M


Sam Wilson

Using sheet reference instead of name
 
Sheets(5)


"Michelle" wrote:

IN the VBE each sheet has a name that looks like "Sheet5(Data)"...
the sheet name is data, and I v=can refer to Sheets("Data"), How can I use
the sheet5 bit - the sheet's 'VB Name'?

Thanks

M


Michelle

Using sheet reference instead of name
 
No guys, this is just theindex position of the sheet within the book and it
changes according to where the sheet comes in the book.

I am looking for a way of refering to the sheet regardless of its name or
position.

Any ideas?

M


"Sam Wilson" wrote in message
...
Sheets(5)


"Michelle" wrote:

IN the VBE each sheet has a name that looks like "Sheet5(Data)"...
the sheet name is data, and I v=can refer to Sheets("Data"), How can I
use
the sheet5 bit - the sheet's 'VB Name'?

Thanks

M



Sam Wilson

Using sheet reference instead of name
 
Ah,

..codename

sub test

dim ws as worksheet
for each ws in activebook.worksheets
msgbox ws.codename & " - " & ws.name
next ws

end sub


"Michelle" wrote:

No guys, this is just theindex position of the sheet within the book and it
changes according to where the sheet comes in the book.

I am looking for a way of refering to the sheet regardless of its name or
position.

Any ideas?

M


"Sam Wilson" wrote in message
...
Sheets(5)


"Michelle" wrote:

IN the VBE each sheet has a name that looks like "Sheet5(Data)"...
the sheet name is data, and I v=can refer to Sheets("Data"), How can I
use
the sheet5 bit - the sheet's 'VB Name'?

Thanks

M




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

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