View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Return position of a sheet in a workbook

Just a heads up that this will work if all the sheets to the left are
worksheets. If you insert a chart sheet as the first sheet, for example, it
will give you the wrong number.

Probably not a problem in your example, but something you should be aware
of.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
try

Sub sheetlocation()
MsgBox ActiveSheet.Index
End Sub

--
Don Guillett
SalesAid Software

"XP" wrote in message
...
I am using Office 2003 on Windows XP.

I need a function that would return an integer or a long that indicates
the
current position of the active sheet, counting the sheets from left to
right.

So if you have sheets named: RawData, Reports, Data, and Calcs in a
workbook
and "Data" is currently the active sheet, the function should return 3.

Your example code would be most appreciated. Thanks much in advance.