Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Return array from worksheet function

Hi there,

I am trying to return an array of dates and prices from a worksheet function
and display them starting at the selected item.

This is the function I am using to test. I've seen this done by people such
as Bloomberg but cannot work how to do it at all. Any help would be much
appreciated.

Thanks,

Steve

Public Function ReturnArray() As Variant

Dim tempArray() As String
ReDim tempArray(1, 1)

tempArray(0, 1) = "Price 1"
tempArray(0, 1) = "17/07/2006"
tempArray(1, 0) = "Price 2"
tempArray(1, 1) = "14/07/2006"

ReturnArray = tempArray

End Function


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 74
Default Return array from worksheet function

Steve,

Looks Ok to me. Are you using CTRL-SHIFT-ENTER to commit?

Additionally maybe you want;

tempArray(0, 0) = "Price 1"

- but I suspect that is just a typo.

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"Steve Lloyd" wrote:

Hi there,

I am trying to return an array of dates and prices from a worksheet function
and display them starting at the selected item.

This is the function I am using to test. I've seen this done by people such
as Bloomberg but cannot work how to do it at all. Any help would be much
appreciated.

Thanks,

Steve

Public Function ReturnArray() As Variant

Dim tempArray() As String
ReDim tempArray(1, 1)

tempArray(0, 1) = "Price 1"
tempArray(0, 1) = "17/07/2006"
tempArray(1, 0) = "Price 2"
tempArray(1, 1) = "14/07/2006"

ReturnArray = tempArray

End Function



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Return array from worksheet function

Hi Chris,

Thanks very much for your response.

I'm really struggling here, I enter the function call in a cell and then
press Ctrl-Shft-Ent, this enters the value in the selected cell but does not
update the additional cells that are part of the array, I presume I am
missing something here, could you help please.

In addition, I want to add the formula from a command button/combo box on a
toolbar as I suspect the users will not be able to understand the
Crtl-Shft-Entr thing (they are traders!) Can you suggest a way of doing
this?

Thanks again,

Steve

"Chris Marlow" wrote in message
...
Steve,

Looks Ok to me. Are you using CTRL-SHIFT-ENTER to commit?

Additionally maybe you want;

tempArray(0, 0) = "Price 1"

- but I suspect that is just a typo.

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"Steve Lloyd" wrote:

Hi there,

I am trying to return an array of dates and prices from a worksheet
function
and display them starting at the selected item.

This is the function I am using to test. I've seen this done by people
such
as Bloomberg but cannot work how to do it at all. Any help would be much
appreciated.

Thanks,

Steve

Public Function ReturnArray() As Variant

Dim tempArray() As String
ReDim tempArray(1, 1)

tempArray(0, 1) = "Price 1"
tempArray(0, 1) = "17/07/2006"
tempArray(1, 0) = "Price 2"
tempArray(1, 1) = "14/07/2006"

ReturnArray = tempArray

End Function





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Return array from worksheet function


Are you entering the function in only one cell, or are you selecting a
2x2 range before entering the function? As with Excel's built in
functions that return an array, you have to select the entire output
range when entering the function to get the entire output array
returned.


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=562104

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Return array from worksheet function

OK, i am there, fantastic, thankyou...



"MrShorty" wrote in
message ...

Are you entering the function in only one cell, or are you selecting a
2x2 range before entering the function? As with Excel's built in
functions that return an array, you have to select the entire output
range when entering the function to get the entire output array
returned.


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile:
http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=562104



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
Using Match function with duplicate values in an array Richard Excel Worksheet Functions 3 April 22nd 23 07:45 PM
Average Function (include Blank Cells and Zeros) [email protected] Excel Discussion (Misc queries) 17 June 27th 06 01:33 PM
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Changing worksheet cells from within a function James4U2enjoy Setting up and Configuration of Excel 1 October 14th 05 02:16 PM
Function to return the current Worksheet name? Steve Excel Worksheet Functions 6 June 29th 05 04:36 AM


All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"