ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA Functions (https://www.excelbanter.com/excel-discussion-misc-queries/110811-vba-functions.html)

tplourde

VBA Functions
 
Why doesn't this function refresh. The only time it refreshes is when I
activate the cell, press F2 and Enter.

Function SheetIndex(rngSheet As Range) As Long
SheetIndex = rngSheet.Parent.Index
End Function

Kevin B

VBA Functions
 
Modify your code by adding this line as the top of the function:

Application.Volatile

SheetIndex = rngSheet.Parent.Index
--
Kevin Backmann


"tplourde" wrote:

Why doesn't this function refresh. The only time it refreshes is when I
activate the cell, press F2 and Enter.

Function SheetIndex(rngSheet As Range) As Long
SheetIndex = rngSheet.Parent.Index
End Function


Jim Cone

VBA Functions
 
It seems to work if you add this line to the code...
Application.Volatile

Ctrl + Alt + F9 also works.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"tplourde"
wrote in message
Why doesn't this function refresh. The only time it refreshes is when I
activate the cell, press F2 and Enter.

Function SheetIndex(rngSheet As Range) As Long
SheetIndex = rngSheet.Parent.Index
End Function

tplourde

VBA Functions
 
Outstanding,

Thankyou

"Kevin B" wrote:

Modify your code by adding this line as the top of the function:

Application.Volatile

SheetIndex = rngSheet.Parent.Index
--
Kevin Backmann


"tplourde" wrote:

Why doesn't this function refresh. The only time it refreshes is when I
activate the cell, press F2 and Enter.

Function SheetIndex(rngSheet As Range) As Long
SheetIndex = rngSheet.Parent.Index
End Function



All times are GMT +1. The time now is 06:03 PM.

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