Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Help with calling a function

I have a spreadsheet:

A1 = "Year"
A2 down through A150 has values 1900 through 2050.

AB1 = "Thanksgiving"

I have written a custom function in a module called "Thanksgiving" and
it takes a year as the parameter.

If I'm in cell AB2, how can I call this function using the values in
AB1 and A2 to get the result. I know I can type in
=THANKSGIVING($AB$1, $A2) but I'd rather build the function call based
on the values already in my spreadsheet.

I've tried building a literal expression, but cannot get Excel to
evaluate it:

="="&AB1&"("&A2&")"

Any ideas? Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Help with calling a function

I made a typo... The paragraph that starts "If I'm in cell AB2..."
should read:

If I'm in cell AB2, how can I call this function using the values in
AB1 and A2 to get the result. I know I can type in
=THANKSGIVING($A2) but I'd rather build the function call based
on the values already in my spreadsheet.

Sorry. Still looking for suggestions. Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Help with calling a function

There is no built in support for having a variable function name.

I think you would need to use an if statement

=if(AB1="Thanksgiving",Thanksgiving(A2),if(AB1="La borDay",LaborDay(A2),""))

An alternative is to create a function named Holiday which takes the name of
the holiday as one of the arguments.

--
Regards,
Tom Ogilvy


"CR" wrote:

I have a spreadsheet:

A1 = "Year"
A2 down through A150 has values 1900 through 2050.

AB1 = "Thanksgiving"

I have written a custom function in a module called "Thanksgiving" and
it takes a year as the parameter.

If I'm in cell AB2, how can I call this function using the values in
AB1 and A2 to get the result. I know I can type in
=THANKSGIVING($AB$1, $A2) but I'd rather build the function call based
on the values already in my spreadsheet.

I've tried building a literal expression, but cannot get Excel to
evaluate it:

="="&AB1&"("&A2&")"

Any ideas? Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Help with calling a function

Same answer.

--
Regards,
Tom Ogilvy


"CR" wrote:

I made a typo... The paragraph that starts "If I'm in cell AB2..."
should read:

If I'm in cell AB2, how can I call this function using the values in
AB1 and A2 to get the result. I know I can type in
=THANKSGIVING($A2) but I'd rather build the function call based
on the values already in my spreadsheet.

Sorry. Still looking for suggestions. Thank you.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Help with calling a function

Thank you for the speedy reply. I guess that's one of many reasons why
Excel is such a piece of crap. Have a great day.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Help with calling a function

You could always role your own function that will operate this way using the
Evaluate command.

--
Regards,
Tom Ogilvy


"CR" wrote:

Thank you for the speedy reply. I guess that's one of many reasons why
Excel is such a piece of crap. Have a great day.


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
Calling a function in my SQL-DB from VBA KSor Excel Discussion (Misc queries) 0 March 11th 09 02:08 PM
calling a function dmexcel Excel Programming 5 February 23rd 06 12:02 PM
Calling Function mattsvai[_18_] Excel Programming 4 February 13th 06 10:49 PM
calling a function praptisahni Excel Programming 2 April 26th 04 05:17 PM
Calling a function from within EXCEL pcor[_2_] Excel Programming 3 July 18th 03 05:10 PM


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