ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extracting worksheet index (https://www.excelbanter.com/excel-programming/326076-extracting-worksheet-index.html)

ziv

Extracting worksheet index
 
I am trying to write a UDF that extract the worksheet index of the cell that
contains the UDF , similar to ThisCell or Thisworkbook. Any suggestions?

Rowan[_2_]

Extracting worksheet index
 
How about

Function thisSheet()
thisSheet = ActiveSheet.Index
End Function

Rowan

"Ziv" wrote:

I am trying to write a UDF that extract the worksheet index of the cell that
contains the UDF , similar to ThisCell or Thisworkbook. Any suggestions?


Rowan[_2_]

Extracting worksheet index
 
Actually scrap that. Doesn't work when the sheet focus changes.

"Rowan" wrote:

How about

Function thisSheet()
thisSheet = ActiveSheet.Index
End Function

Rowan

"Ziv" wrote:

I am trying to write a UDF that extract the worksheet index of the cell that
contains the UDF , similar to ThisCell or Thisworkbook. Any suggestions?


Myrna Larson

Extracting worksheet index
 
This line should do what the OP requests:

SheetNumber = Application.Caller.Parent.Index

On Wed, 23 Mar 2005 17:35:03 -0800, "Rowan"
wrote:

How about

Function thisSheet()
thisSheet = ActiveSheet.Index
End Function

Rowan

"Ziv" wrote:

I am trying to write a UDF that extract the worksheet index of the cell

that
contains the UDF , similar to ThisCell or Thisworkbook. Any suggestions?



Bob Phillips[_6_]

Extracting worksheet index
 
You need to be aware that adding/deleting a new does not trigger a recalc,
so the index doesn't get automatically updated.

--

HTH

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


"Myrna Larson" wrote in message
...
This line should do what the OP requests:

SheetNumber = Application.Caller.Parent.Index

On Wed, 23 Mar 2005 17:35:03 -0800, "Rowan"


wrote:

How about

Function thisSheet()
thisSheet = ActiveSheet.Index
End Function

Rowan

"Ziv" wrote:

I am trying to write a UDF that extract the worksheet index of the cell

that
contains the UDF , similar to ThisCell or Thisworkbook. Any

suggestions?





All times are GMT +1. The time now is 07:29 AM.

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