Code:
Sub GetAllHCodes()
Dim m As Object, s As String, a, n As Long
s = Range("A1")
With CreateObject("vbscript.regexp")
    .Pattern = "H[0-9]{5,6}"
    .Global = True
    If .test(s) Then
        Set m = .Execute(s)
        For Each a In m
            n = n + 1
            Cells(n, 2) = a
        Next
    End If
End With
End Sub