Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure of the technical term for this but an example of
what's stumping me is this: Say I have three constants: const CONV_DWEEZIL = 1 const CONV_MOONBUCKET = 2 const CONV_FRANK = 3 and I have write a function that will have an argument passed with part of the name of a constant (or global variable) and a value: I want to be able to reference the correct constant (or variable etc) by concatanating the strings. I know I've done it with other packages but can't find the correct syntax in VBA. e.g. function TimesName(ac_Value as currency, as_Name as string) as currency TimesName = ac_Value * "CONV_" & as_Name **** I want this line to act as though it read --- end function .. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There isn't any support for this like there is in Foxpro or dbase for
example. You would have to use a case statement I would think Select Case as_Name Case "DWEEZIL" lngMult = CONV_DWEEZIL Case "MOONBUCKET" lngMult = CONV_MOONBUCKET Case "FRANK" lngMult = CONV_FRANK End Select TimesName = ac_Value * lngMult -- Regards, Tom Ogilvy "PC" wrote in message ... Not sure of the technical term for this but an example of what's stumping me is this: Say I have three constants: const CONV_DWEEZIL = 1 const CONV_MOONBUCKET = 2 const CONV_FRANK = 3 and I have write a function that will have an argument passed with part of the name of a constant (or global variable) and a value: I want to be able to reference the correct constant (or variable etc) by concatanating the strings. I know I've done it with other packages but can't find the correct syntax in VBA. e.g. function TimesName(ac_Value as currency, as_Name as string) as currency TimesName = ac_Value * "CONV_" & as_Name **** I want this line to act as though it read --- end function . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I change a Name scope from local to Global? | Excel Discussion (Misc queries) | |||
How can I change a Name scope from local to Global? | Excel Discussion (Misc queries) | |||
Global name used in local version | Excel Discussion (Misc queries) | |||
User Defined Functions - local or global? | Excel Worksheet Functions | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions |