Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation add-in - UDF to multi cells...

Hi all,

I have been doing some reading on this forum and could not find exactly
what i was looking for so i decided to post. I have an automation add-in
written in C#. I need a UDF function to populate multiple cells with
data. (like a table of data, and the cell containing the UDF function
would be the top left corner of the 'rendered' table).

Is this possible?

I have read that a UDF function can only return and populate a single
cell. Well there must be some way to do it as I have seen other add-ins
do this, and im trying to replicate the behaviour.

Thanks!

Dale

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Automation add-in - UDF to multi cells...

A UDF can only return something to the range that holds that UDF.

But if you select the range (say A1:B4) and array enter your formula (using
ctrl-shift-enter), then all 8 of these cells could be populated by that single
array formula in multiple cells.

I don't speak the C#, but in VBA, I'd use this kind of thing:

Option Explicit
Function myFunct() As Variant
Dim myArr(1 To 4, 1 To 2) As Variant
Dim rCtr As Long
Dim cCtr As Long

For rCtr = LBound(myArr, 1) To UBound(myArr, 1)
For cCtr = LBound(myArr, 2) To UBound(myArr, 2)
myArr(rCtr, cCtr) = "R" & rCtr & "--" & "C" & cCtr
Next cCtr
Next rCtr

myFunct = myArr

End Function




dale purdon wrote:

Hi all,

I have been doing some reading on this forum and could not find exactly
what i was looking for so i decided to post. I have an automation add-in
written in C#. I need a UDF function to populate multiple cells with
data. (like a table of data, and the cell containing the UDF function
would be the top left corner of the 'rendered' table).

Is this possible?

I have read that a UDF function can only return and populate a single
cell. Well there must be some way to do it as I have seen other add-ins
do this, and im trying to replicate the behaviour.

Thanks!

Dale

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
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
[Automation] Why do my cells with formula appear as text? Stuart Excel Programming 1 November 15th 07 09:02 AM
Pulling values out of cells using automation seabird Excel Programming 0 August 4th 06 12:49 PM
multi function cells kellerfro Excel Discussion (Misc queries) 4 June 27th 05 07:34 PM
Multi Select Cells David Excel Programming 2 February 15th 05 06:35 PM
Numberformat for Cells using Automation bavjean Excel Programming 3 February 8th 05 12:07 PM


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