Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translate range name passed as string to a custom function to range addresses!
Hi All
I am trying to write a custom function where I am passing a range nam as a string. This range name can comprise of 1 or more range area delimited by commas (,). These range areas may or may not be contiguou areas. For example, if my custom function is called "myFunc()" this is how i will look like (shown below) :- Function myFunc(rangeName as string) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translate range name passed as string to a custom function to range addresses!
Function myFunc(rangeName as string)
dim dblSum as Double set rng = Range(rangeName) for each cell in rng if isnumeric(cell) then dblSum = dblSum + cdbl(cell.value) end sub Next myFunc = dblSum End Sub -- regards, Tom Ogilvy "agarwaldvk " wrote in message ... Hi All I am trying to write a custom function where I am passing a range name as a string. This range name can comprise of 1 or more range areas delimited by commas (,). These range areas may or may not be contiguous areas. For example, if my custom function is called "myFunc()" this is how it will look like (shown below) :- Function myFunc(rangeName as string) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translate range name passed as string to a custom function to range addresses!
Tom
Thanks a lot for your quick response. Greatly appreciated. I take it that "rng" is to be dimmed as Range. I didn't know a range name could be converted to a range simply b doing so :- Range(range name) Great! Thanks again! I have learnt something today! Best regards Deepak Agarwa -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Translate range name passed as string to a custom function to range addresses!
yes, rng should be dimmed as Range
-- Regards, Tom Ogilvy "agarwaldvk " wrote in message ... Tom Thanks a lot for your quick response. Greatly appreciated. I take it that "rng" is to be dimmed as Range. I didn't know a range name could be converted to a range simply by doing so :- Range(range name) Great! Thanks again! I have learnt something today! Best regards Deepak Agarwal --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to use a range in a custom function? | Excel Worksheet Functions | |||
ClearContents method on a passed range | New Users to Excel | |||
Error Converting Passed Range into Array in VBA for Excel | Excel Programming | |||
Error Converting Passed Range into Array in VBA for Excel | Excel Programming | |||
Getting a function to return a formated Range string | Excel Programming |