Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default passing defined name to vb

i have a large list of defined names which are various currency an
futures prices. is there a way to have a subroutine or function acces
these values w/o having to pass each one as am argument. depending o
the value entered into a cell i want to access a different define
name. for example, if a cell has EurGbp entered in it i want to acces
the EUR and GBP named range from the function. I have seen examples o
how to access a single defined range fro ma formula but not a large an
growing list of names. thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default passing defined name to vb

assume EurGbp is in Cell A1 of the active sheet

set rng = Range(Left(Range("A1").Value,3))
set rng1 = Range(Right(Range("A1").Value,3))
msgbox rng.Address(External:=True) & vbNewLine & _
rng1.Address(External:=True)

--
Regards,
Tom Ogilvy

"bmeehan " wrote in message
...
i have a large list of defined names which are various currency and
futures prices. is there a way to have a subroutine or function access
these values w/o having to pass each one as am argument. depending on
the value entered into a cell i want to access a different defined
name. for example, if a cell has EurGbp entered in it i want to access
the EUR and GBP named range from the function. I have seen examples of
how to access a single defined range fro ma formula but not a large and
growing list of names. thanks.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default passing defined name to vb

An example

Function myCalc(currencies)
Dim i As Long
Dim temp

For i = 1 To Len(currencies) Step 3
temp = Range(Mid(currencies, i, 3)) + temp
Next i

myCalc = temp
MsgBox myCalc

End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"bmeehan " wrote in message
...
i have a large list of defined names which are various currency and
futures prices. is there a way to have a subroutine or function access
these values w/o having to pass each one as am argument. depending on
the value entered into a cell i want to access a different defined
name. for example, if a cell has EurGbp entered in it i want to access
the EUR and GBP named range from the function. I have seen examples of
how to access a single defined range fro ma formula but not a large and
growing list of names. thanks.


---
Message posted from http://www.ExcelForum.com/



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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Passing a range to a user defined function Gary Nelson Excel Discussion (Misc queries) 1 July 19th 07 04:22 PM
passing arrays to user defined functions ramki Excel Worksheet Functions 2 February 15th 06 08:34 AM
passing a range to a user defined function using a form davek Excel Programming 1 December 24th 03 07:40 AM
Passing an Array of User-Defined Type to an Argument of a Function Tushar Mehta[_6_] Excel Programming 0 August 17th 03 06:43 PM


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