Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default User Defined formula, selecting range

By passing the range to the function as a UDF, you can be flexible. For
instance, say your UDF is

Function myUDF(rng as Range)
Dim cell As Range
For Each cell in rng
myUDF=myUDF + cell.Value
Next cell
End Function

You can call it with one cell

=myUDF(A1)

many cells

=myUDF(A1:A10)

a multiple row/column range

=myUDF(A1:H10)

What you cannot do is use the format that you can with some built-in
functions, such as

=myUDF(A1,B10,C9)

although it could be changed to cater for that as well.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
ups.com...
Hello,

Can someone tell me how to make a user defined formula in Excel that
ables one to select a (flexibel) range.
The formula has to be something similar to the standard VBA statement:

Activecell.Select
Selection.End(xlDown).Select

Thanx a lot for your help!!!!

regards,
Robert



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
User-defined range for graph royend Excel Discussion (Misc queries) 3 September 4th 07 09:11 AM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
external range in VBA (user defined formula) BrianB Excel Programming 2 July 23rd 03 06:25 PM
external range in VBA (user defined formula) Tim Zych[_2_] Excel Programming 0 July 22nd 03 02:02 AM


All times are GMT +1. The time now is 02:34 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"