Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
swiftcode
 
Posts: n/a
Default Defined Named cells lined to a Function Procedure

Hi All,

I have a problem with an excel funtion that i created, i have a series of
defined named range pointing to various cells, however, i cannot seem to call
them out within my procedure. Could anyone please help? It is like something
below:


Function CCY_CALC(PosVal, CCY)

CCYType = CCY

Select Case CCYType
Case "AUD"
' AUD_USD is the defined name which points to a cell with the amount of 1.3

RateD = CCY_CALC * AUD_USD

Case "CAD"
' AUD_USD is the defined name which points to a cell with the amount of 1.01

RateD = CCY_CALC * CAD_USD

End Select


CCY_CALC = RateD

End Function

Thanks in advance
Ray

  #2   Report Post  
swiftcode
 
Posts: n/a
Default

Hi all,

Sorry slight error in my code, it should be as follows:



Function CCY_CALC(PosVal, CCY)

CCYType = CCY

Select Case CCYType
Case "AUD"
' AUD_USD is the defined name which points to a cell with the amount of 1.3

RateD = PosVal * AUD_USD

Case "CAD"
' AUD_USD is the defined name which points to a cell with the amount of 1.01

RateD = PosVal * CAD_USD

End Select


CCY_CALC = RateD

End Function

  #3   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi SwiftCode,

Change:

RateD = PosVal * AUD_USD

to
RateD = PosVal * Range("AUD_USD")

and change:

RateD = PosVal * CAD_USD

to
RateD = PosVal * Range("CAD_USD")

---
Regards,
Norman



"swiftcode" wrote in message
...
Hi all,

Sorry slight error in my code, it should be as follows:



Function CCY_CALC(PosVal, CCY)

CCYType = CCY

Select Case CCYType
Case "AUD"
' AUD_USD is the defined name which points to a cell with the amount of
1.3

RateD = PosVal * AUD_USD

Case "CAD"
' AUD_USD is the defined name which points to a cell with the amount of
1.01

RateD = PosVal * CAD_USD

End Select


CCY_CALC = RateD

End Function



  #4   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi SwiftCode,

And that would be better with:

RateD = PosVal * Range("AUD_USD").Value

and

RateD = PosVal * Range("CAD_USD").Value

Whilst Value is the default property of the range object, it is good
practice to be explicit.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi SwiftCode,

Change:

RateD = PosVal * AUD_USD

to
RateD = PosVal * Range("AUD_USD")

and change:

RateD = PosVal * CAD_USD

to
RateD = PosVal * Range("CAD_USD")

---
Regards,
Norman



"swiftcode" wrote in message
...
Hi all,

Sorry slight error in my code, it should be as follows:



Function CCY_CALC(PosVal, CCY)

CCYType = CCY

Select Case CCYType
Case "AUD"
' AUD_USD is the defined name which points to a cell with the amount of
1.3

RateD = PosVal * AUD_USD

Case "CAD"
' AUD_USD is the defined name which points to a cell with the amount of
1.01

RateD = PosVal * CAD_USD

End Select


CCY_CALC = RateD

End Function





  #5   Report Post  
swiftcode
 
Posts: n/a
Default

Hi Norman,

Thank you very much.

Rgds
Ray


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
Blank cells in named range- how to ignore them when making my graph? Help plz! KR Excel Discussion (Misc queries) 0 August 24th 05 02:35 PM
Offset Function works in cell, not in named range DragonslayerApps Excel Worksheet Functions 0 July 25th 05 04:39 PM
multi function cells kellerfro Excel Discussion (Misc queries) 4 June 27th 05 07:34 PM
Excel option to store trendline's coefficients in cells for use Miguel Saldana Charts and Charting in Excel 9 June 20th 05 08:45 PM
how to move user defined function Grant Excel Worksheet Functions 1 November 17th 04 06:38 PM


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