Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to find No of sheets ,sheet no

Hi ,
Is there any option to find the no of sheets in the work book and any
possible to find the "sheets no" or sheets position

for example: In my workbook contains worksheets

Traffic2005,Customer,Tax2005,Mar 2006

Instead of using sheets name, i want to use the sheets's no
like
Traffic2005 - "1"
Customer- "2"
Tax2005-"3"
Mar 2006-"4"

Thanks in advance for your reply.

Have a nice day.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to find No of sheets ,sheet no

Your have a couple of choices:

Dim i As Long

For i = 1 To ThisWorkbook.Worksheets.Count
Debug.Print ThisWorkbook.Worksheets(i).Name
Next

'or
Dim WS As Worksheet

For Each WS In ThisWorkbook.Worksheets
Debug.Print WS.Name
Next

NickHK

"Vadhimoo" wrote in message
...
Hi ,
Is there any option to find the no of sheets in the work book and any
possible to find the "sheets no" or sheets position

for example: In my workbook contains worksheets

Traffic2005,Customer,Tax2005,Mar 2006

Instead of using sheets name, i want to use the sheets's no
like
Traffic2005 - "1"
Customer- "2"
Tax2005-"3"
Mar 2006-"4"

Thanks in advance for your reply.

Have a nice day.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to find No of sheets ,sheet no

Hi Vadhimoo

You can use the index

Sheets(1).Range("A1").Value

But if people change the order this will give strange results<g

You can also use the code name to avoid this problem

In the VBA editor you see
Sheet1(Sheet1)

You can use
Sheet1.Range("A1").Value

You can change the code name in the properties


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Vadhimoo" wrote in message ...
Hi ,
Is there any option to find the no of sheets in the work book and any
possible to find the "sheets no" or sheets position

for example: In my workbook contains worksheets

Traffic2005,Customer,Tax2005,Mar 2006

Instead of using sheets name, i want to use the sheets's no
like
Traffic2005 - "1"
Customer- "2"
Tax2005-"3"
Mar 2006-"4"

Thanks in advance for your reply.

Have a nice day.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to find cell content in sheets and make sheet active Nigel Excel Discussion (Misc queries) 4 June 26th 14 02:38 PM
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Excel Discussion (Misc queries) 7 September 23rd 09 10:02 PM
search all sheets in book to find value and activate sheet with va Nigel Excel Programming 3 November 22nd 05 08:43 AM
How to find the type of Sheet in Excel.Workbook.sheets collection Raj[_7_] Excel Programming 3 December 9th 03 10:48 PM
Allocate Files to Sheets and Build a Master Sheet which Summarises All Sheets hanuman Excel Programming 0 September 9th 03 11:23 AM


All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"