justdriving
10-15-2011, 06:37 AM
Hi, I need help from somebody to explain me Step-by-Step what this VBA code is doing?
Please mark a comment after every step.
Someone will answer to search HELP in VBE at Right top box.
Dim DirSep As String
Dim LibPath As String
Dim AnalysisPath As String
Dim WorkbookName As String
Dim FunctionIDs(130, 0 To 1)
Private Function GetMacroRegId(FuncText As String) As String
Debug.Print ("[GetMacroRegId] '" & FuncText & "' <")
For i = LBound(FunctionIDs) To UBound(FunctionIDs)
If (LCase(FunctionIDs(i, 0)) = LCase(FuncText)) Then
If (Not (IsError(FunctionIDs(i, 1)))) Then
GetMacroRegId = FunctionIDs(i, 1)
Debug.Print ("[GetMacroRegId] '" & FuncText & "' -> '" & GetMacroRegId & "' >")
Exit Function
End If
End If
Next i
Debug.Print ("[GetMacroRegId] Error while finding '" & FuncText & "' >")
End Function
Function Bin2Hex(number As Variant, Optional places As Variant) As Variant
Bin2Hex = Application.Run(GetMacroRegId("BIN2HEX"), number, places)
End Function
Please mark a comment after every step.
Someone will answer to search HELP in VBE at Right top box.
Dim DirSep As String
Dim LibPath As String
Dim AnalysisPath As String
Dim WorkbookName As String
Dim FunctionIDs(130, 0 To 1)
Private Function GetMacroRegId(FuncText As String) As String
Debug.Print ("[GetMacroRegId] '" & FuncText & "' <")
For i = LBound(FunctionIDs) To UBound(FunctionIDs)
If (LCase(FunctionIDs(i, 0)) = LCase(FuncText)) Then
If (Not (IsError(FunctionIDs(i, 1)))) Then
GetMacroRegId = FunctionIDs(i, 1)
Debug.Print ("[GetMacroRegId] '" & FuncText & "' -> '" & GetMacroRegId & "' >")
Exit Function
End If
End If
Next i
Debug.Print ("[GetMacroRegId] Error while finding '" & FuncText & "' >")
End Function
Function Bin2Hex(number As Variant, Optional places As Variant) As Variant
Bin2Hex = Application.Run(GetMacroRegId("BIN2HEX"), number, places)
End Function