I struggling to convert back the BCD to STR, if anyone quickly knows how to do it I really appreciate it.
Public Function strBCDToStr(ByVal shIn As Short) As String
'BCD to Text
Dim m_strTemp As String = ""
For m_iLoop As Integer = 1 To 4
m_strTemp = Chr((shIn Mod 16) + 48) & m_strTemp
shIn = (shIn \ (16S))
Next
strBCDToStr = m_strTemp
End Function
Since we're only dealing with
shortthis works out as a simple mapping to standard hex notation. We can reverse it like this:Technically I could even combine those two statements and make this method a one-liner.
See it here for every possible input up to the limit of fiddle:
We can also simplify the original code like so: