LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Returning full contents of an array to excel

Tom, Bernie

Thanks for your direction - this has been hurting my head all day!!



On 13 Jul, 13:57, "Bernie Deitrick" <deitbe @ consumer dot org wrote:
Kay,

Select at least as many cells in a column as dates that you expect to have returned, then enter

=get_workdays(A1, A2)

and press Ctrl-Shift-Enter

You are returning an array of values from your UDF, and need to array enter it to have it work.

HTH,
Bernie
MS Excel MVP

"Kay" wrote in message

ups.com...



Hi
I use Excel 2002 and am stumbling on how to return a VBA array to a
spreadsheet
I have the below function which calcs the workdays between 2 parameter
dates.
When executed it returns only the first element rather than the whole
array
Any suggestions on where I am going wrong? Thanks, Kay


Public Function get_workdays(dteStart As Date, dteEnd As Date) As
Variant


Dim dteTEST As Date
Dim i As Integer
Dim varArray() As Variant
Dim iDays As Integer


iDays = NETWORKDAYS(dteStart, dteEnd)
ReDim varArray(iDays - 1)


varArray(0) = dteStart
i = 1
For i = 1 To UBound(varArray)
varArray(i) = workday(varArray(i - 1), 1)
Next i


get_workdays = Application.WorksheetFunction.Transpose(varArray)


End Function- Hide quoted text -


- Show quoted text -



 
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
Difference between dates returning full months and remaining days kvan Excel Discussion (Misc queries) 5 October 7th 09 04:07 PM
Excel workbook contents only visible in Full Screen mode ... Sharon R. Excel Discussion (Misc queries) 0 April 2nd 08 12:26 PM
vlookup not returning full field value (text) JohnC Excel Worksheet Functions 0 June 27th 06 12:03 PM
Matching contents of a cell full of text brien downie Excel Programming 1 March 24th 06 10:03 PM
Returning an array in excel mick Excel Programming 2 February 16th 04 04:07 PM


All times are GMT +1. The time now is 05:01 AM.

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"