excel-udf

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

假装没事ソ 提交于 2020-07-16 02:41:04
问题 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. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

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

烂漫一生 提交于 2020-07-16 02:39:13
问题 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. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

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

梦想与她 提交于 2020-07-16 02:36:37
问题 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. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

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

心不动则不痛 提交于 2020-07-16 02:36:25
问题 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. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

function to convert String to upper case

夙愿已清 提交于 2020-06-27 07:50:08
问题 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 removeSpecial(sInput As String) As String Here is the code in it's entirety: Function removeSpecial(sInput As String) As String Dim sSpecialChars As String Dim i As Long sSpecialChars = "\/:*?™""®<>|.&@# (_+`©~);-+=^$!,'" 'This is your list of

How to use goal seek function in Excel user function?

扶醉桌前 提交于 2020-03-04 04:22:51
问题 There is method to use goal seek in MS excel like follows code. It works fine. Sub GSeek() With Worksheets("Sheet1") .Range("H18").GoalSeek _ Goal:=.Range("H21").Value, _ ChangingCell:=.Range("G18") End With End Sub And I would like to use a function to do the goal seek like follows. Function fSeek(a As Range, b As Range, c As Range) a.GoalSeek Goal:=b.Value, ChangingCell:=c fSeek = "Ok" End Function However, the code work peacefully and no answer was got in the range c. Where am I wrong? 回答1

Making a CountRows function in Excel

好久不见. 提交于 2020-01-24 00:48:26
问题 I am trying to make a simple countRows function that will count the number of cells I have in a dynamic range. Basically if I have values in cells, say B2:B500, the count would return 499. However next time around values are in cell B2:B501, the count would return 500. But you wouldn't have to do anything to the cell in which you typed in the formula. I thought if I reference the cell as a Variant , then any value could be accepted. Then find the Address of that cell and return the Count of a

#VALUE error when dealing with long string in UDF in VBA(excel)

牧云@^-^@ 提交于 2020-01-17 11:34:42
问题 I've encountered #VALUE error when using an UDF returning an array with long strings (>256 symbols). Sample Code: Function longString() As Variant Dim res(1 To 1, 1 To 2) res(1, 1) = "hellohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\nhellohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\nhellohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\nhellohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhellohh\n" res(1, 2) = "world" longString = res End Function