在新的工作簿中使用Personal.xlsb函数? [英] Use Personal.xlsb function in new workbook?
问题描述
这是我的功能,保存在我的 Personal.xlsb
中的Module1中:
公共函数GetColumnLetter(colNum As Integer)As String
Dim d As Integer
Dim m As Integer
Dim name As String
d = colNum
name =
Do While(d> 0)
m =(d - 1)Mod 26
name = Chr(65 + m)+ name
d = Int (d-m)/ 26)
循环
GetColumnLetter = name
结束函数
我已经创建了一个新的工作簿,并且以为我可以通过 = getcolumnletter(1)
来调用,但是当我启动时,该函数不会填充打字 = ...
我是否俯瞰某物?如何在没有VBA的其他工作簿中使用此功能?
感谢任何建议!
啊,这比我想象的更简单。只需在宏之前使用工作簿名称 - 所以 = Personal.xlsb![macroname]
。所以在我的情况下,我只是把它放入单元格中: = Personal.xlsb!GetColumnLetter(2)
返回B。
I've searched around and I know how to call a function from Personal.xlsb from a VB macro, but how can I call the function to be used in a new workbook?
Here's my function, saved in 'Module1' in my Personal.xlsb
:
Public Function GetColumnLetter(colNum As Integer) As String
Dim d As Integer
Dim m As Integer
Dim name As String
d = colNum
name = ""
Do While (d > 0)
m = (d - 1) Mod 26
name = Chr(65 + m) + name
d = Int((d - m) / 26)
Loop
GetColumnLetter= name
End Function
I have created a new workbook and thought I could call that just by =getcolumnletter(1)
, but the function doesn't "populate" when I start typing =...
Am I overlooking something?? How do I use this function in other workbooks, without VBA?
Thanks for any advice!
Ah, it was more simple than I thought. Just use the workbook name before the macro - so =Personal.xlsb![macroname]
. So in my case, I just put this into the cell: =Personal.xlsb!GetColumnLetter(2)
to return "B".
这篇关于在新的工作簿中使用Personal.xlsb函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!