Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default UDF second range-input incorrect

Hi sages,

Just for having weekend fun. Let's for simplicity have a UDF with two
variant/ranges arguments. If the dimension of the second (distant) one
differs from that of the first, calculation error in the function should be
trapped and therefore registered by means of MsgBox. In the moment, however,
when a user tries to select the second of range-inputs by dragging, even
pointing at the first cell of this range is immediately accepted and, due to
trapped error messages, the input obstinately fails. With difficulties two
cells can be selected at once but nothing more. The user must shift the
"dragging" selection to upper input line or type down the whole range address
in the input box manually. How would a professional (especially the most
valuable one) build the macro so that the UDF would be more user friendly?

For elucidation of the problem:

Function RangesDifferent(A, B) As Boolean
If A.Count < B.Count Then
MsgBox "Dimensions of ranges differ"
RangesDifferent = True
End If
End Function

With all regards and thanks

--
Petr Bezucha
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default UDF second range-input incorrect

My guess: a professional would not use MsgBox in a UDF. The purpose of a UDF
is to return a value to a cell. Subroutines are used for all other purposes.
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"PBezucha" wrote in message
...
Hi sages,

Just for having weekend fun. Let's for simplicity have a UDF with two
variant/ranges arguments. If the dimension of the second (distant) one
differs from that of the first, calculation error in the function should
be
trapped and therefore registered by means of MsgBox. In the moment,
however,
when a user tries to select the second of range-inputs by dragging, even
pointing at the first cell of this range is immediately accepted and, due
to
trapped error messages, the input obstinately fails. With difficulties two
cells can be selected at once but nothing more. The user must shift the
"dragging" selection to upper input line or type down the whole range
address
in the input box manually. How would a professional (especially the most
valuable one) build the macro so that the UDF would be more user friendly?

For elucidation of the problem:

Function RangesDifferent(A, B) As Boolean
If A.Count < B.Count Then
MsgBox "Dimensions of ranges differ"
RangesDifferent = True
End If
End Function

With all regards and thanks

--
Petr Bezucha



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default UDF second range-input incorrect


Are you calling the function from a worksheet cell or from withi
another procedure? Calling the function from a worksheet cell,
couldn't recreate the problem

--
MrShort
-----------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...fo&userid=2218
View this thread: http://www.excelforum.com/showthread.php?threadid=52851

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default UDF second range-input incorrect

Thanks for both remarks. First, you soothed my conscience: there is not a
gimmick I could have passed. Second, you diverted my way from excessive ca
I in fact fully realized that quite similar Slope and Intercept do not
hesitate to return only #N/A in analogous situation.
Best wishes for next useful answers to some screwy questions. Pity the
number exponentially rises, so even the gems of replies are mostly lost.

--
Petr Bezucha


MrShorty pÃ*Å¡e:


Are you calling the function from a worksheet cell or from within
another procedure? Calling the function from a worksheet cell, I
couldn't recreate the problem.


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=528514


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
List Box - For Input Range can I use named range in another workbo dim Excel Worksheet Functions 2 January 3rd 08 06:10 PM
Input range Irishrose28 Charts and Charting in Excel 1 August 4th 06 04:35 PM
Input box range - output range al007 Excel Programming 5 November 21st 05 03:05 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM
Macro to input formula in range based on another range Peter Atherton Excel Programming 0 October 9th 03 12:47 AM


All times are GMT +1. The time now is 10:20 AM.

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"