This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function FxMin(ByVal ThisArray) | |
'Return the minimum value in an array (Excel style) | |
Dim Res, LBnd, UBnd, Idx | |
LBnd = LBound(ThisArray) | |
UBnd = UBound(ThisArray) | |
Res = ThisArray(LBnd) | |
If UBnd > LBnd Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function FindCount(Needle As String, Haystack As String) As Long | |
'See how many times the Needle occurs in the Haystack | |
Dim Res As Long | |
Dim Temp As String | |
Res = 0 | |
If Len(Needle) <> 0 Then | |
Temp = Replace(Haystack, Needle, "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function DecodeXml(TextToDecode As String) As String | |
'Take text that has been encoded for XML and change it to normal text | |
Dim Res As String | |
Res = Replace(Replace(Replace(Replace(TextToDecode, """, """"), ">", ">"), "<", "<"), "&", "&") | |
DecodeXml = Res | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function GetColLetter(ByVal ColNum As Long) As String | |
'Get the letter of a column based on the number | |
Dim Res As String | |
Res = Split(Cells(1, ColNum).Address, "$")(1) | |
GetColLetter = Res | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub WriteToFile(ByVal FilePath, ByVal TxtToWrite) | |
'Write any line of text to the end of a file. If the file does not exist, try to create it | |
On Error Resume Next | |
Dim FileSysObj, FileHandle | |
Set FileSysObj = CreateObject("Scripting.FileSystemObject") | |
If FileSysObj.FileExists(FilePath) Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub QuickSort(ByRef ThisArray) | |
'Sort an array alphabetically | |
Dim LowerBound, UpperBound | |
LowerBound = LBound(ThisArray) | |
UpperBound = UBound(ThisArray) | |
QuickSortRecursive ThisArray, LowerBound, UpperBound | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function InArray(ByVal ElementToFind, ByVal ArrayToSearch) | |
'Look to see if an element is in an array. | |
'Return index of element if found | |
'Return -1 if not found | |
Dim Res, LBnd, UBnd, Idx | |
Res = -1 | |
If IsArray(ArrayToSearch) Then |