1 Attachment(s)
Number stored as text, alignment of numeric values in cells
This is post https://www.excelfox.com/forum/showt...ll=1#post21923
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21923&viewfull=1#post21923
Page #58 https://www.excelfox.com/forum/showt...s-etc-)/page58
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page58
Some notes arising from discussions in this Thread
http://www.eileenslounge.com/viewtop...61085a6575decc
Edit Aug 2023: The general ideas are OK here, but we all overlooked, or maybe did not understand fully some basic stuff about how Range and range "values" in this basic code line work, Range2.Value = Range1.Value. Because of this some of the stuff in the final actual solution are redundant: - in particular, the solution of 1x and related stuff.
See
https://www.excelfox.com/forum/showt...el-Cell/page10
https://www.excelfox.com/forum/showt...el-Cell/page11
https://www.excelfox.com/forum/showt...el-Cell/page12
Number stored as text, alignment of numeric values in cells
This problem/feature pops up from time to time.
https://i.postimg.cc/GpwT3Mzj/Number-stored-as-text.jpg
https://i.postimg.cc/18B3Jrkg/Number-stored-as-text.jpg Attachment 5104
I have seen it so far in these sort of places/ things, such as text box contents are strings by definition , …VBA enters text that is inherent to a TextBox. Every 'number' in a textBox is a string "1234". VBA has to convert those strings into long/integer, etc….
, and when pasting things out,
https://www.eileenslounge.com/viewto...269105#p269105 https://eileenslounge.com/viewtopic....272704#p272704
, but it’s not always consistent, - in the next example the 3 seems to go in as a number, but the 4 and 5 go in as …" Number stored as text"
https://i.postimg.cc/cCzwRfG1/Number...onsistancy.jpg
Code:
' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21923&viewfull=1#post21923
Sub Number_stored_as_text__alignment_of_numeric_values_in_cells() ' https://i.postimg.cc/cCzwRfG1/Number-stored-as-text-inconsistancy.jpg
Dim Ex As String
Let Ex = "3"
Let ActiveSheet.Range("A10").Value = Ex ' Puts in as number
Dim Exs(1 To 2) As String: Let Exs(1) = "4": Exs(2) = "5"
Let ActiveSheet.Range("A11:B11").Value = Exs()
End Sub
https://i.postimg.cc/cCzwRfG1/Number...onsistancy.jpg
2 Attachment(s)
Developing an Evaluate Range solution
In support of these forum posts
https://www.excelfox.com/forum/showt...ll=1#post23981
https://eileenslounge.com/viewtopic....313971#p313971
Developing an Evaluate Range solution
In column A we have things like this: (just showing the first few words in each row for clarity )
Shell.OmitFromView -- PKEY_Shell_Omi …..
SimpleRating -- PKEY_SimpleRating // Type: UInt32 – VT…..
Size -- PKEY_Size ……….// Type: UInt64 – VT
SoftwareUsed -- PKEY_SoftwareUsed// Type: Strin …
SourceItem -- PKEY_SourceItem // Typ …….
I only want this sort of thing
Shell.OmitFromView
SimpleRating
Size
SoftwareUsed
SourceItem
, so the first character set before any spaces
Spreadsheet Formula
So lets try to get those character sets in the fourth column ( Column D ) ,.
Building up a spreadsheet formula to do that is easy. Here is an example:
_____ Workbook: WSO_PropNamesExtended.xls ( Using Excel 2013 32 bit )
| Row\Col |
A |
B |
C |
| 2 |
Address.Country -- PKEY_Address_Country
// Type: String -- VT_LPWSTR (For variants: VT_BSTR)
// FormatID: {C07B4199-E1DF-4493-B1E1-DE5946FB58F8}, 100
DEFINE_PROPERTYKEY(PKEY_Address_Country, 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8, 100);
#define INIT_PKEY_Address_Country { { 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8 }, 100 }
|
=SEARCH(" -- PKEY",A2) |
=LEFT(A2,B2-1) |
| 3 |
Address.CountryCode -- PKEY_Address_CountryCode
// Type: String -- VT_LPWSTR (For variants: VT_BSTR)
// FormatID: {C07B4199-E1DF-4493-B1E1-DE5946FB58F8}, 101
DEFINE_PROPERTYKEY(PKEY_Address_CountryCode, 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8, 101);
#define INIT_PKEY_Address_CountryCode { { 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8 }, 101 }
|
=SEARCH(" -- PKEY",A3) |
=LEFT(A3,B3-1) |
| 4 |
Address.Region -- PKEY_Address_Region
// Type: String -- VT_LPWSTR (For variants: VT_BSTR)
// FormatID: {C07B4199-E1DF-4493-B1E1-DE5946FB58F8}, 102
DEFINE_PROPERTYKEY(PKEY_Address_Region, 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8, 102);
#define INIT_PKEY_Address_Region { { 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8 }, 102 }
|
=SEARCH(" -- PKEY",A4) |
=LEFT(A4,B4-1) |
Worksheet: Ext(Hidden)proph
_____ Workbook: WSO_PropNamesExtended.xls ( Using Excel 2013 32 bit )
| Row\Col |
A |
B |
C |
| 2 |
Address.Country -- PKEY_Address_Country
// Type: String -- VT_LPWSTR (For variants: VT_BSTR)
// FormatID: {C07B4199-E1DF-4493-B1E1-DE5946FB58F8}, 100
DEFINE_PROPERTYKEY(PKEY_Address_Country, 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8, 100);
#define INIT_PKEY_Address_Country { { 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8 }, 100 }
|
16 |
Address.Country |
| 3 |
Address.CountryCode -- PKEY_Address_CountryCode
// Type: String -- VT_LPWSTR (For variants: VT_BSTR)
// FormatID: {C07B4199-E1DF-4493-B1E1-DE5946FB58F8}, 101
DEFINE_PROPERTYKEY(PKEY_Address_CountryCode, 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8, 101);
#define INIT_PKEY_Address_CountryCode { { 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8 }, 101 }
|
20 |
Address.CountryCode |
| 4 |
Address.Region -- PKEY_Address_Region
// Type: String -- VT_LPWSTR (For variants: VT_BSTR)
// FormatID: {C07B4199-E1DF-4493-B1E1-DE5946FB58F8}, 102
DEFINE_PROPERTYKEY(PKEY_Address_Region, 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8, 102);
#define INIT_PKEY_Address_Region { { 0xC07B4199, 0xE1DF, 0x4493, 0xB1, 0xE1, 0xDE, 0x59, 0x46, 0xFB, 0x58, 0xF8 }, 102 }
|
15 |
Address.Region |
Worksheet: Ext(Hidden)proph
Now, in column D we simply paste the last working formula , ( from column C ) , and then look from the left of column C so as to get the formula only referring to the first column. That way we can do away with the columns B and C
_____ Workbook: WSO_PropNamesExtended.xls ( Using Excel 2013 32 bit )
| Row\Col |
D |
| 2 |
=LEFT(A2,SEARCH(" -- PKEY",A2)-1) |
| 3 |
=LEFT(A3,SEARCH(" -- PKEY",A3)-1) |
| 4 |
=LEFT(A4,SEARCH(" -- PKEY",A4)-1) |
Worksheet: Ext(Hidden)proph
VBA Evaluate Range solution.
The simple direct Evaluate Range implementation would be
Evaluate("LEFT(A2:A1055,SEARCH("" -- PKEY"",A2:A1055)-1)")
As sometimes happens we find that this needs a little trick to get all the available values, since otherwise just the first value is returned.
This final working Evaluate Range line does the trick,
Evaluate("IF({1},LEFT(A2:A1055,SEARCH("" -- PKEY"",A2:A1055)-1))")
Here is a full coding to get the property name words in column E in the uploaded file
Code:
Option Explicit
' https://www.excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA-CSV-stuff?p=23979&viewfull=1#post23979
Sub ExtendedPropertiesList()
' Rem 1 Get the text file as a long single string
Dim FileNum As Long: Let FileNum = FreeFile(1) ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
Dim PathAndFileName As String, TotalFile As String
Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & "propkey h.txt" '
Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundamental type data input...
' Let TotalFile = Space(LOF(FileNum)) '....and wot receives it has to be a string of exactly the right length
'Get #FileNum, , TotalFile
' Or http://www.eileenslounge.com/viewtopic.php?p=295782&sid=f6dcab07c4d24e00e697fe4343dc7392#p295782
Let TotalFile = Input(LOF(FileNum), FileNum)
Close #FileNum
' Rem 2 Split the Prophs
Dim arrProphs() As String: Let arrProphs() = Split(TotalFile, "// Name: System.", -1, vbBinaryCompare)
' 2a) Quick look at list
Dim LCnt As Long: Let LCnt = UBound(arrProphs())
Dim Rws() As Variant, Clms() As Variant, VertList() As Variant
Let Rws() = Evaluate("ROW(1:" & LCnt + 1 & ")/ROW(1:" & LCnt + 1 & ")")
Let Clms() = Evaluate("ROW(1:" & LCnt + 1 & ")")
Let VertList() = Application.Index(arrProphs(), Rws(), Clms())
Let Me.Range("A1:A" & LCnt & "") = VertList()
Me.Cells.WrapText = False
'' 2b) Look at some example props using function WtchaGot_Unic_NotMuchIfYaChoppedItOff
'' The next text is copied from cell A 350
'' "Size -- PKEY_Size
'' // Type: UInt64 -- VT_UI8
'' // FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 12 (PID_STG_SIZE)
'' //
'' //
'' DEFINE_PROPERTYKEY(PKEY_Size, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 12);
'' #define INIT_PKEY_Size { { 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC }, 12 }
''
'' "
'' The next text is copied from watch window at arrProphs()(349)
'' : arrProphs()(349) : "Size -- PKEY_Size
'' // Type: UInt64 -- VT_UI8
'' // FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 12 (PID_STG_SIZE)
'' //
'' //
'' DEFINE_PROPERTYKEY(PKE"
' Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(arrProphs()(349), "Size349")
Rem 3 Evaluate Range to get just the property to use in like .ExtendedProperty("System.Size")
Dim arrExtProps() As Variant '
Let arrExtProps() = Me.Evaluate("IF({1},LEFT(A2:A1055,SEARCH("" -- PKEY"",A2:A1055)-1))")
' 3b) Paste into a worksheet column
Let Me.Range("E2:E1055") = arrExtProps()
'Stop
End Sub
https://i.postimg.cc/90Znck96/Ext-Pr...n-Column-E.jpg
Attachment 5753 https://i.postimg.cc/sGfccwwm/Ext-Pr...n-Column-E.jpg
https://i.postimg.cc/90Znck96/Ext-Pr...n-Column-E.jpg
1 Attachment(s)
Call Out Text In Cell Formula
this is post #598
https://www.excelfox.com/forum/showt...ll=1#post24089
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=24089&viewfull=1#post24089
https://www.excelfox.com/forum/showt...ge60#post24089
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page60#post24089
Rem 2 Put formula in cell (Sub CarriageReturnLineFeedExcelVBAFormula() )
Having forced myself into going back to the basics, and getting a more deeper understanding of Evaluate(" ") , the problems in some syntax in putting formulas into a cell , or finding text things via an excel formula in Evaluate(" ") , which caused the excursion of this page , is easy to do, and sure to get it, as long as we are patient and cautious.
So armed with some knowledge of constructing the necessary strings, and some initial attempt at a a Results Summary Conclusion attempt we move on to get the same value in a cell as previously, but from a formula, that is to say, taking Evaluate(" ") string constructs that one step further to actually put a formula in a cell …. pseudo
Put in the cell = a formula looking like , ="Hello"
, using
Put in the cell = Evaluate( string construct to actually give a formula, not the result from it )
Note , of course, you will still see the value result in the cell, but an indication that we actually put on a formula, rather than a value, should be seen in the formula bar, just as if we manually typed the formula in, ( assuming default Excel settings )
https://i.postimg.cc/9Mf54ycw/Formul...splay-text.jpg
Attachment 5829 https://i.postimg.cc/McgrNMMz/Formul...splay-text.jpg
https://i.postimg.cc/9Mf54ycw/Formul...splay-text.jpg
An extra quote, or two, and stuff
Having battled out enough with the basics in the last few posts, it’s actually not so difficult from now on
Points to note
_1) literal text in a cell, needs to be put in initially, "in the first place" as it were, in quotes in the string construct for evaluate just to prevent Evaluate(" ") trying to interpret the text as some particular Excel thing. So far we did this explicitly like this
Evaluate("""" & "Mytext" & """")
, which you would have to do if your text was in a variable , - example if your text was in a string variable, strText, then you would need to do this
Evaluate("""" & strText & """")
, or we could consder the new line pair things we have been considering as variables, and as such also need to do like
Evaluate("""" & vbCr & vbLf & """")
For actual text, this would be the same
Evaluate("""Mytext""")
, but I would recommend always being explicit until maybe you have finished.
Based on the results and attempted explanations of Evaluate(" ") so far generally, and with a bit of hindsight again, I might have a go at a slightly modified explanation of Evaluate(" ")
If you or I type an = at the start of putting something in a cell, then that is a significant thing that calls into action deep Office innards coding which I expect is either the same, or in some way strongly related to, or very similar to, the coding that gets set off by Evaluate(" "). There will be similarities therefore in the result, where I am using the word result in its broadest sense here: Just one example of this similarity is that it could be that a text or number appearing in the cell would be that which would appear in a variable, Ex if you did something like this
Ex = Evaluate("What you put in a cell after typing in a = at the start")
But that is just part of the story, perhaps what is often given as the simplifies version of what Evaluate(" ") is about.
More fully, the string what VBA "sees" will need to be a syntax, or named thing, that Excel recognises, and its always very good practice when constructing the string in Evaluate, ( strEval, where strEval is like here, Evaluate(strEval) ) , to check what VBA sees via Debug.Print strEval
I expect there may be a priority to the order that things are done.
Calling something out
First, a reference to an object or something will have a varied effect. Maybe we could refer this to calling it out, like shouting at someone to call them to attention. It may make them do something or get them there, ready. We sometimes hear of "exposing an interface" having a similar effect to running it. I like the sound of calling it out
Do a formula to do something (even a formula!)
This is easy to get mislead and confused. If a string construct, what VBA finally "sees", can be recognised as a syntax that Excel would be happy with in a cell, A formula, then the result that would be obtained of that string with an = in front of it, in a cell, is what Evaluate(" ") will try to return. At a stretch of the imagination, this could be regarded as calling out an imaginary cell, by its name, its cell reference, where the imaginary cell has that formula in it. This should perhaps spark off someone smarter to get excited and tell me about kicking off an Excel4 macro somehow. Just now it’s a leap too far for my brain. But I think the idea is potentially sound
Having got to this level of understanding, maybe we can do close to anything , within reason, even … put a formula in a cell
So let’s have a go. Introduction to formula in a cell
Backwards working understand, to easier perhaps is this. (This is perhaps easier to understand, working backwards.)
For example , I want this formula to effectively be put in a cell ,
="Hello"
, which will mean that I see Hello in the cell, and in the formula bar I will see ="Hello"
If I was using VBA to put that formula in a cell, I would need to construct the VBA string context for that, which would be like
Range("A10") = "=""Hello"""
To achieve that from a code line like ,
Range("A10") = Evaluate("")
, then Evaluate("") will need to return "=""Hello"""
So far we have learnt that for returning "Hello" in VBA , the RHS == Evaluate("") , would need to look like this
Evaluate("""" & "Hello" & """")
In simplified terms, we can say that in that construction , the 4 quotes, """" is getting us a single quote in that "Hello" in VBA
So a simplified logic perhaps tells us we need a few more of the 4 quotes, """" bits, ( as well as an = somewhere )
Just looking carefully , and applying the simple logic tells us we want : a quote; a =; 2 quotes; the text Hello ; and finally 3 quotes.
So perhaps we want this VBA context string
Evaluate(VBA context string)
"""" & "=" & """" & """" & "Hello" & """" & """" & """"
This next simple coding shows the construction clearly breaking down each required string bit
Code:
Sub CallOutTextInCellFormula() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=24089&viewfull=1#post24089
' Effectively put ="Hello" in a cell , which will mean that I see in the cell Hello and in the formula bar ="Hello"
Let Range("A10") = "=""Hello"""
' we need from Evaluate(" ") a quote, a =, 2 quotes, Hello , and finally 3 quotes
' " = " " Hello " " "
Let Range("A10") = Evaluate("""" & "=" & """" & """" & "Hello" & """" & """" & """")
End Sub
Having got this far, at the final stage, we can simplify quite easily, if we wish to. The thing here to remember is that the & is only required to
_ link or glue variables or other VBA things to each other
or _ to link or glue variables or other VBA things to text
It is not required to link or glue text to text.
This means that bits like " & " can be removed
Do that with our last example, and you end up with this rather impressive looking beautiful thing
"""=""""Hello"""""""
Just to confuse or impress a little further, we have noted previously the somewhat "flexible" = that Evaluate(" ") seems to posses. There is no exception here, so we could add that last bit of apparent mystical magicness to that last string construction
"=""=""""Hello"""""""
Code:
Sub CallOutTextInCellFormula() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=24089&viewfull=1#post24089
' Effectively put ="Hello" in a cell , which will mean that I see in the cell Hello and in the formula bar ="Hello"
Let Range("A10") = "=""Hello"""
' we need from Evaluate(" ") a quote, a =, 2 quotes, Hello , and finally 3 quotes
' " = " " Hello " " "
Let Range("A10") = Evaluate("""" & "=" & """" & """" & "Hello" & """" & """" & """")
'
' simplified
Let Range("A10") = Evaluate("""=""""Hello""""""")
Let Range("A10") = Evaluate("=""=""""Hello""""""")
End Sub
_._________________
&
A small reminder about the & in string context both In VBA and Excel spreadsheet syntax.
As we seen already in a coupe of places ( https://www.excelfox.com/forum/showt...ll=1#post24083
https://www.excelfox.com/forum/showt...ll=1#post24050 ) we have this same "gluing together" thing in both Excel and VBA.
If the formula we are trying finally to put in a cell has in Excel a & , then that & will effectively be another bit of text to add.
Note also in the following example to get like a formula ="Hello"&" You" we cannot rely on Evaluate(" ") to somehow return us VBA connecting / gluing & bits , so we must do some simplification in such example cases.
Code:
Sub CallOutTextInCellFormula() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=24089&viewfull=1#post24089
' Effectively put ="Hello" in a cell , which will mean that I see in the cell Hello and in the formula bar ="Hello"
Let Range("A10") = "=""Hello"""
' we need from Evaluate(" ") : a quote; a =; 2 quotes; Hello ; and finally 3 quotes
' " = " " Hello " " "
Let Range("A10") = Evaluate("""" & "=" & """" & """" & "Hello" & """" & """" & """")
'
' simplified
Let Range("A10") = Evaluate("""=""""Hello""""""")
Let Range("A10") = Evaluate("=""=""""Hello""""""")
' Put ="Hello"& "You" in a cell
Let Range("A11") = "=""Hello""" & "&" & """ You"""
' Evaluate will not be ablk to return the two connecting/ gluing VBA things " & " so we will need to be at the simplified level
Let Range("A11") = "=""Hello""&"" You"""
' we need from Evaluate(" ") : a quote; a =; 2 quotes; Hello ; 2 quotes ; the & ; 2 quotes ; You ; and finally 3 quotes
Let Range("A11") = Evaluate("""" & "=" & """" & """" & "Hello" & """" & """" & "&" & """" & """" & " You" & """" & """" & """")
' simplified
Let Range("A11") = Evaluate("""=""""Hello""""&"""" You""""""")
End Sub
Evaluate(" ") The Ultimate explanation
this is post #600
https://www.excelfox.com/forum/showt...ll=1#post24133
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=24133&viewfull=1#post24133
https://www.excelfox.com/forum/showt...ge60#post24133
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page60#post24133
Evaluate(" ")
This is often seen to be allowing Excel spreadsheet things to be done in VBA, and therefore a simplified explanation and some Blogs on Evaluate(" ") , the Evaluate method, will concentrate on this feature of it. That is not necessarily misleading, and is not a bad simplified start point.
After a lot of head breaking , I think I have a statement(s)/ ideas from which I am happy to expand and add flesh to in order to explain away both the accepted conventional things done with it, and to some extent the more advanced interesting and not always accepted unconventional things I have done, and also some more recent little discoveries, (which because of previous reactions I am never going to make public until when/if I become very rich and famous, so that I can afford a small army of the best body guards)
Here we go , it's like this:
This would be my entry in a simple dictionary, or the very first bit in an explanation:
___Evaluate _ (Callout an Excel object by referring thereto)
Call out is in the sense of bringing it to attention via some sort of reference string or name , and this is sometimes referred to as exposing an interface. A Run or a Call of something are a similar thing. We often experience that using a recognised text will make something happen . An Excel in built function and a User Defined Function, (UDF), can reasonably be considered to be similar things, even an Excel object, if Object is used in its very broadest sense, as is reasonably acceptable and certainly not conflicting with the somewhat bodged together form of apparent object orientated programming that VBA is. Don’t be confused that I went over to VBA there - what I am suggesting there is that the wrapper for the function coding has the name for referral to be Called of the routine name, which is recognised by Excel – in other words the name of a UDF is recognised by Excel, - as most of us will know, that is true of a Public Function in a normal code module, which is what a UDF is.