Questions tagged [excel-udf]

User-defined functions (UDFs) are VBA procedures that typically take inputs (although inputs are not mandatory) to return a result to either a worksheet cell, or to another VBA procedure. By design UDF's that are called from a worksheet should only return a value to the cell from where the function was called - the UDF should not modify the contents or formatting of any cell, or the operating environment of Excel (there are workarounds to this design).

90 questions
156
votes
28 answers

Function to convert column number to letter?

Does anyone have an Excel VBA function which can return the column letter(s) from a number? For example, entering 100 should return CV.
mezamorphic
  • 13,455
  • 46
  • 103
  • 168
26
votes
3 answers

How do I create a real-time Excel automation add-in in C# using RtdServer?

I was tasked with writing a real-time Excel automation add-in in C# using RtdServer for work. I relied heavily on the knowledge that I came across in Stack Overflow. I have decide to express my thanks by writing up a how to document that ties…
Frank
  • 2,759
  • 4
  • 31
  • 43
9
votes
2 answers

Excel 2007 UDF: how to add function description, argument help?

The description I am writing a couple of Excel UDFs in COM Servers. I'd like to get the standard help (Insert Function dialog) that you get when you press fx. Yes, I can see my COM Server listed in among the Category drop down, but I also see…
hughdbrown
  • 42,826
  • 20
  • 80
  • 102
7
votes
2 answers

function to convert String to upper case

I have been trying to make a user defined function I wrote return it's value in all upper case, using the String.ToUpper() method in VBA. When I try to use my UDF in excel, I get a compiler error that just highlights the top line of my UDF: Function…
user2993456
6
votes
2 answers

How to force an argument in an Excel UDF

I've created an excel UDF that accepts an array input. I want it only to allow an even number of items in the array. Here's the code: (it's only short so I'll post it all and that way you can have some context) Function SUBSTITUTEMULTI(inputString…
Greedo
  • 3,465
  • 2
  • 19
  • 49
6
votes
2 answers

How to reuse Core VBA functions (UDFs) across projects, but not show them in cell insert function

I have an Addin with "core" functions and subs that I want to reference and use in different Addins or VBA projects. Because of the code reuse and single update principles. For example, a function, that filters collection members based on criteria…
kolcinx
  • 2,133
  • 1
  • 12
  • 34
5
votes
6 answers

Formula to eliminate all but alpha characters

I need to scrub a column of names in Excel to eliminate all non-Alpha characters including periods, commas, spaces, hyphens and apostrophes. EXAMPLE: Change O'Malley-Smith, Tom, Jr. to OMALLEYSMITHTOMJR The client requires this to be an Excel…
dwwilson66
  • 6,086
  • 27
  • 66
  • 106
5
votes
3 answers

Loop Though All UDF Names in Project

This question: Searching for function usage in Excel VBA got me thinking about a process for automating a search for all UDFs being used in a spreadsheet. Something along the lines of: For Each UDF in Module1 If Cells.Find(What:=UDF.Name,…
Chrismas007
  • 6,002
  • 3
  • 20
  • 45
5
votes
1 answer

How to keep reference to add-in UDF when workbook moved to different folder than add-in?

I wrote an Excel add-in that provides UDFs (user-defined worksheet functions). All is well until one user sends his workbook using those functions to another user, or just tries to use the workbook on more than one computer, where the add-in has…
Greg Lovern
  • 868
  • 2
  • 18
  • 30
4
votes
1 answer

can excel vba function open a file?

i'm defining a function to save files as .xls format: Public Function save_as_xls(full_file_path As String) As String save_as_xls = "" Dim src_file As Workbook Set src_file = Workbooks.Open(full_file_path) src_file.SaveAs…
athos
  • 5,550
  • 3
  • 40
  • 81
4
votes
1 answer

Running node.js code in Excel user-defined function

It would be nice if one can run node.js code inside Excel user-defined functions. Something like using js code like VBA. I googled for solutions but cannot find any. Is it possible to do this?
user3848207
  • 2,358
  • 11
  • 33
  • 59
4
votes
2 answers

Automatic calculation of Excel VBA UDF related to cell properties

I have written an UDF to count cells of certain color and with certain LineStyles, I'm posting the entire function: Function CountTime(rData As Range, cellRefColor As Range) As Variant Dim indRefColor As Long Dim cellCurrent As Range …
SimonMoon
  • 43
  • 6
3
votes
1 answer

Why is my XLL slower than my UDF?

I have been trying to speed up a macro by using XLLs, however, it seems is a lot faster with the UDF than with the XLL. Some data with code profiling demonstrates it XLL Time for the sub Proc:module 1 iteration 11.64831 seconds UDF Time for the…
Sgdva
  • 2,276
  • 2
  • 12
  • 24
3
votes
2 answers

Putting an Excel UDF into the Worksheet object (as opposed to in a module)

I suspect the answer is "not possible" - but there is no harm in asking this fine community! I have a Excel 2013 UDF (User Defined Function) that is unique to a certain worksheet. Currently, I have this UDF in a "Module" in the containing Workbook.…
Nic
  • 88
  • 5
3
votes
3 answers

Copy sheets with udf to a new workbook

I have a workbook with 5 sheets full of UDF (user defined functions). I need to copy these 5 sheets to a new workbook but I only need the values. The problem is that when I copy these sheets all cells with UDF became broken with #value on it,…
hend
  • 515
  • 1
  • 5
  • 12
1
2 3 4 5 6