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!
If you want to share your Personal. xlsb file with others, you can copy it to the XLSTART folder on other computers. In Windows 10, Windows 7, and Windows Vista, this workbook is saved in the C:\Users\user name\AppData\Local\Microsoft\Excel\XLStart folder.
An easier way to make your custom functions available at all times is to store them in a separate workbook and then save that workbook as an add-in (an XLA file) in your XLStart folder. (The XLStart folder is a subfolder of the folder containing your Excel files.
Your Personal. xlsb file is stored in a folder called XLSTART. If you want to share your macros with someone else, you can copy it to the XLSTART folder on other computers, or copy some or all of its macros to the Personal.
Steps to make Macro available in all Workbooks Go to Files > Options > Add-in and select the above Excel file/Macro from the list of Inactive Application Add-ins & Click Go. This step makes the function/macro available for all workbook.
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With