Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old June 14th 04, 01:20 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jun 2004
Posts: 2
Default function of a range of cells

How do I write a function, like =SUM(B6:B10) so that it
will operate on a range of cells selected in the
worksheet?

Also, is there a way to see the code for the built-in
functions so that I can reverse engineer?

Thanks.

-cnb



  #2   Report Post  
Old June 14th 04, 01:31 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Nov 2003
Posts: 11,272
Default function of a range of cells


"Christopher Brooks" wrote in message
...
How do I write a function, like =SUM(B6:B10) so that it
will operate on a range of cells selected in the
worksheet?


You can't. You could have event code to update a SUM cell on selection.

Also, is there a way to see the code for the built-in
functions so that I can reverse engineer?


Again, you can't, it is company confidential. If you want an algorithm, look
up on the web, there are plenty out there.


  #3   Report Post  
Old June 14th 04, 01:51 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2006
Posts: 340
Default function of a range of cells

Chris, you can create user defined functions that take a cell range as an
argument. If the function is in a workbook, it can only be used by that
workbook. If it is an add-in, it can be used by all open workbooks. If you
send the workbook using the function to another user, they will need to
authorize macros if it is in the workbooks, or install the add-in if it is
used by the add-in. There are advantages both ways.

The following is a simple user function that returns the number of non-empty
cells in a range

Function NonEmpty(anyR As Range)
Dim cell As Range
Dim I As Long
For Each cell In anyR
If Not IsEmpty(cell) Then I = I + 1
Next
NonEmpty = I
End Function

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Christopher Brooks" wrote in message
...
How do I write a function, like =SUM(B6:B10) so that it
will operate on a range of cells selected in the
worksheet?

Also, is there a way to see the code for the built-in
functions so that I can reverse engineer?

Thanks.

-cnb






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
Function to concatenate cells in a range Leporello Excel Worksheet Functions 2 June 3rd 10 11:54 PM
Using value in two cells as the range for a MAX function Mark Excel Discussion (Misc queries) 3 May 29th 09 10:02 PM
if function or lookup??? across a range of cells in a row. jwbuyer Excel Worksheet Functions 2 February 24th 09 06:41 PM
Insert range of cells with a function firsttimer Excel Worksheet Functions 2 May 29th 07 09:43 AM
How to apply a function across a range of cells Paul Excel Programming 0 July 9th 03 10:42 PM


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

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017