Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default function with more functionality then typical UDFs?

Hello,

I would like to create a function, such that if I type

"=testfunction(noRows, noCols)"

into a cell in Excel, say A1, then the range beginning from A1 until
cell(noRows, noCols) is filled with "1". Of course, this isn't
possible with UDFs in VBA, but I have seen it before with some special
programs which can be added/installed into Excel and provide such a
functionality. I was thinking about implementing a C#/.NET method that
way, save it in some file, and everyone who wants to use this function
would then just need to install/reference(?) this file that I would
provide him.

Any ideas/suggestions/links/keywoards which I can look up?

Thanks a lot in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default function with more functionality then typical UDFs?

Why not just select an area noRows x noCols, enter a 1 in the formula bar,
and then hit Ctrl-Enter?


HTH

Bob

"xtriant" wrote in message
...

Hello,

I would like to create a function, such that if I type

"=testfunction(noRows, noCols)"

into a cell in Excel, say A1, then the range beginning from A1 until
cell(noRows, noCols) is filled with "1". Of course, this isn't
possible with UDFs in VBA, but I have seen it before with some special
programs which can be added/installed into Excel and provide such a
functionality. I was thinking about implementing a C#/.NET method that
way, save it in some file, and everyone who wants to use this function
would then just need to install/reference(?) this file that I would
provide him.

Any ideas/suggestions/links/keywoards which I can look up?

Thanks a lot in advance!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default function with more functionality then typical UDFs?

Hi Bob, thanks for the quick answer - but to fill the range with 1s
was just a simple example.

Later I will need to fill the range with different input which is
going to be specified in the testfunction and which in fact will take
more parameters than just noRows and noCols.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default function with more functionality then typical UDFs?

I'd go with and .xla that your users can reference, the .xla would
have a userform that could be called with a keyboard shortcut and the
userform would capture the parameters used for populating the range.
Then on the form there would be click button that would call a code
to populate the range.


On Jan 5, 10:58*am, xtriant wrote:
Hi Bob, thanks for the quick answer - but to fill the range with 1s
was just a simple example.

Later I will need to fill the range with different input which is
going to be specified in the testfunction and which in fact will take
more parameters than just noRows and noCols.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default function with more functionality then typical UDFs?

Thanks for the suggestion; however, I will really need the
"testfunction" to be later a complicated C#-method. Also for
convenience, it should be built that way that one only needs to type
in "=testfunction(...)" into a cell having the applications later in
mind.

On 5 Jan., 15:30, AB wrote:
I'd go with and .xla that your users can reference, the .xla would
have a userform that could be called with a keyboard shortcut and the
userform would capture the parameters used for populating the range.
Then on the form there would be *click button that would call a code
to populate the range.

On Jan 5, 10:58*am, xtriant wrote:







Hi Bob, thanks for the quick answer - but to fill the range with 1s
was just a simple example.


Later I will need to fill the range with different input which is
going to be specified in the testfunction and which in fact will take
more parameters than just noRows and noCols.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default function with more functionality then typical UDFs?

I could be mixing apples & oranges here but I thought that MS
explicitly removed the functionality where a function could actually
alter the data in other cells - because of security issues.
Perhaps here shows also my lack of knowledge of c# - I'm very much
just a vba person.
In theory what you need can still be achieved with .xla and vba - you
can create a class withevents ws and then have ws_change event check
what exactly changed and if a user entered formula
"=testfunction(...)" then do such & such.
But perhaps there are way much more elegant solutions to accomplish
the same thing.

On Jan 5, 3:04*pm, xtriant wrote:
Thanks for the suggestion; however, I will really need the
"testfunction" to be later a complicated C#-method. Also for
convenience, it should be built that way that one only needs to type
in "=testfunction(...)" into a cell having the applications later in
mind.

On 5 Jan., 15:30, AB wrote:



I'd go with and .xla that your users can reference, the .xla would
have a userform that could be called with a keyboard shortcut and the
userform would capture the parameters used for populating the range.
Then on the form there would be *click button that would call a code
to populate the range.


On Jan 5, 10:58*am, xtriant wrote:


Hi Bob, thanks for the quick answer - but to fill the range with 1s
was just a simple example.


Later I will need to fill the range with different input which is
going to be specified in the testfunction and which in fact will take
more parameters than just noRows and noCols.- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default function with more functionality then typical UDFs?

Perhaps this helps you further:

in a module use this:
----------------------------------------------------------------------
Function testfunction(a, b As Integer)
stringtp = a & "," & b
testfunction = stringtp
End Function
----------------------------------------------------------------------
on the worksheet use this:

----------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("a1"), Target) Is Nothing Then

ar = ActiveCell.Row
ac = ActiveCell.Column

st1 = Cells(1, 1)
dd = Left(st1, 1)
ee = Right(st1, 1)

qq = InputBox("fill-in")

For r = ar To ar + dd
For c = ac To ac + ee
Cells(r, c) = qq
Next c
Next r

End If
End Sub
----------------------------------------------------------------------


hope this helps
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default function with more functionality then typical UDFs?

On 5 Jan., 17:09, Master Blaster wrote:
Perhaps this helps you further:

in a module use this:
----------------------------------------------------------------------
Function testfunction(a, b As Integer)
stringtp = a & "," & b
testfunction = stringtp
End Function
----------------------------------------------------------------------
*on the worksheet use this:

----------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
* * If Not Application.Intersect(Range("a1"), Target) Is Nothing Then

ar = ActiveCell.Row
ac = ActiveCell.Column

st1 = Cells(1, 1)
dd = Left(st1, 1)
ee = Right(st1, 1)

qq = InputBox("fill-in")

For r = ar To ar + dd
* For c = ac To ac + ee
* * *Cells(r, c) = qq
* Next c
Next r

End If
End Sub
----------------------------------------------------------------------

hope this helps




Thanks very much for the answers to far but I am afraid, my problem
remains. In fact, the best way for me would be to not touch VBA at
all. I really need to work with a C# method later which would
determine the input of the different cells in the range.

I am thinking of somehow doing it using a COM-Add-In, created with
Visual Studio C#/.NET - which can then be installed/referenced into
Excel. But all examples/code in this direction which I have found were
not helpful.

Any ideas in this direction? Or in another direction which does not
involve touching VBA?
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default function with more functionality then typical UDFs?

What AB said; a cell function can not write to remote cells.

So you are confusing methods and languages. Whether this is VBA or VB or
VB.NET or C# makes no difference, you simply can not do this with a cell
function. But you can do it with what VB/VBA knows as a Sub, in a xla or
xlam addin, or a COM addin, no matter which language it's written in.

HTH. Best wishes Harald

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default function with more functionality then typical UDFs?

On 5 Jan., 20:38, "Harald Staff" wrote:
What AB said; a cell function can not write to remote cells.

So you are confusing methods and languages. Whether this is VBA or VB *or
VB.NET or C# makes no difference, you simply can not do this with a cell
function. But you can do it with what VB/VBA knows as a Sub, in a xla or
xlam addin, or a COM addin, no matter which language it's written in.

HTH. Best wishes Harald


Unfortunately, I still don't know how to proceed. I guess, I need to
learn some basics on xll-Addins in order to see how I can build my
solution which the user just needs to add and then access the
"testfunction" as described above. If anyone has a link/suggestion how
I can learn more in this area, I'd be very grateful.


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default function with more functionality then typical UDFs?

On 5 Jan., 20:56, xtriant wrote:
On 5 Jan., 20:38, "Harald Staff" wrote:

What AB said; a cell function can not write to remote cells.


So you are confusing methods and languages. Whether this is VBA or VB *or
VB.NET or C# makes no difference, you simply can not do this with a cell
function. But you can do it with what VB/VBA knows as a Sub, in a xla or
xlam addin, or a COM addin, no matter which language it's written in.


HTH. Best wishes Harald


Unfortunately, I still don't know how to proceed. I guess, I need to
learn some basics on xll-Addins in order to see how I can build my
solution which the user just needs to add and then access the
"testfunction" as described above. If anyone has a link/suggestion how
I can learn more in this area, I'd be very grateful.


Thanks to all for the answers,
I consider the thread closed.
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
Chart help on a not so typical spread sheet Andrew Arens Charts and Charting in Excel 1 May 20th 09 03:16 PM
need to make 4 typical entries regularly in excel sameer adhikari Excel Worksheet Functions 3 February 23rd 09 11:01 AM
Pivot Table Typical example Sandeep Jangra[_2_] New Users to Excel 2 October 16th 08 02:06 AM
Typical Problem vijaydsk1970 Excel Worksheet Functions 5 March 24th 07 08:53 PM
Typical excel interviewing questions Interview Excel Discussion (Misc queries) 3 July 14th 05 11:10 PM


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