|
>わからないのは、
>>>実は変則30進法でして・・・
>>>0,1,2,3,4,5,6,7,8,9,a,c,d,e,f,g,h,j,k,m,n,p,r,t,u,v,w,x,y
このとおりだとした場合の簡単なサンプルです。
新規ブックの標準モジュールに
'==================================================================
Option Explicit
Private arefarray As Variant
Private a_edvalue As String
Private a_idx() As Long
'===================================================================
Sub abnor30_init(ByVal stvalue As String, ByVal edvalue As String)
Dim g0 As Long
Erase a_idx()
arefarray = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", _
"a", "c", "d", "e", "f", "g", "h", "j", _
"k", "m", "n", "p", "r", "t", "u", "v", "w", "x", "y")
a_edvalue = Trim(edvalue)
ReDim a_idx(1 To Len(Trim(edvalue)))
For g0 = 1 To Len(Trim(edvalue))
a_idx(g0) = -1
Next
For g0 = 1 To Len(Trim(stvalue))
a_idx(UBound(a_idx) - g0 + 1) = Application.Match(LCase(Mid(stvalue, Len(stvalue) - g0 + 1, 1)), _
arefarray, 0) - 1
Next
End Sub
'======================================================================
Function abnor30_get(myvalue As String) As Long
Dim g0 As Long
abnor30_get = 0
For g0 = UBound(a_idx()) To LBound(a_idx()) Step -1
If a_idx(g0) + 1 <= UBound(arefarray) Then
a_idx(g0) = a_idx(g0) + 1
If a_idx(g0) = 0 Then a_idx(g0) = 1
Exit For
Else
a_idx(g0) = 0
End If
Next
myvalue = ""
On Error Resume Next
For g0 = LBound(a_idx()) To UBound(a_idx())
Err.Clear
myvalue = myvalue & arefarray(a_idx(g0))
If Err.Number <> 0 Then myvalue = ""
Next
If myvalue = LCase(a_edvalue) Then abnor30_get = 1
On Error GoTo 0
End Function
'=======================================================================
Sub abnor30_term()
Erase arefarray
a_edvalue = ""
Erase a_idx()
End Sub
別の標準モジュールに
'=================================================================
Sub test()
Dim g0 As Long
Dim myvalue As String
Call abnor30_init("073X18050", "073X18099")
Cells(g0 + 1, 1).Value = "073X18050"
g0 = g0 + 1
Do While abnor30_get(myvalue) = 0
Cells(g0 + 1, 1).Value = UCase(myvalue)
g0 = g0 + 1
Loop
Cells(g0 + 1, 1).Value = UCase(myvalue)
Call abnor30_term
End Sub
として、testを実行してみてください
アクティブシートのA列に
073X18050
073X18051
073X18052
073X18053
073X18054
073X18055
073X18056
073X18057
・
・
・
073X18099
と羅列表示します。
因みに上記の例だとセルA1からA126までデータが表示されました。
このようなことですか?
>
>これがどうして30進数なのですか?
>29しか文字はないですが・・・。
>そこが変則の所以ですか?
>>後は、この変則30進数の説明をしてください。
|
|