LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default OFFSET and UDF bug

There seems to be a bug in the way UDFs handle input Range parameters which
use OFFSET:
In a workbook with more than one sheet add the following UDF:

Function SheetCheck(theRange as range)
SheetCheck=theRange
end function

on Sheet 1 put 1 in cell a1
on Sheet2 put 2 in cell a1

in sheet 1 b1 put
=sheetcheck(Sheet1!$A$1:OFFSET(Sheet1!$A$1,1,0))
in sheet 1 b2 put
=sheetcheck(OFFSET(Sheet1!$A$1,0,0,1,1))

select Sheet 1 and press F9: both cells show 1
select Sheet 2 and press F9: select sheet 1 and you will see that B1 shows 2
but B2 shows 1

The formula in B1 incorrectly refers to the active sheet rather than Sheet1

(tested on Excel97 Excel2000 and Excel2002)

This bug also happens when using Defined names containing these kinds of
formulae: this makes it important when using Dynamic Range Names to use the
second type of Offset formulae rather than the first.


Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com


 
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
Offset Q Seanie Excel Worksheet Functions 6 January 16th 09 03:11 AM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Using Offset in VBA Matthew[_2_] Excel Discussion (Misc queries) 1 September 9th 07 05:12 PM
OFFSET HELP Scott@CW Excel Worksheet Functions 1 December 21st 06 04:27 AM
Offset help comotoman Excel Discussion (Misc queries) 1 December 21st 05 06:17 PM


All times are GMT +1. The time now is 05:30 PM.

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

About Us

"It's about Microsoft Excel"