Öncelikle sizin de bayramınız kutlu olsun. Çok basit hali ile kodunuzu aşağıdaki ile değiştirip dener misiniz? İstediğiniz bu yönde ise geliştirelim.
On Error GoTo Err_KODGRUBUURET4
Dim i As Integer, j As Integer
Dim strSource As String
Dim strSource1 As String
Dim strTarget As String
'*** used with the RND() function to return
' a random number
Randomize
strSource = "12345678901234567890"
strSource1 = "ABCÇDEFGHIİJKLMNOÖPQRSŞTUÜVWXYZ"
strTarget = ""
For i = 1 To strlen
'*** select a character position at random
If KSec1 = "h1" Then j = Int((Len(strSource1) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource1, j, 1)
Else: j = Int((Len(strSource) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource, j, 1)
End If
If KSec2 = "h1" Then j = Int((Len(strSource1) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource1, j, 1)
Else: j = Int((Len(strSource) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource, j, 1)
End If
If KSec3 = "h1" Then j = Int((Len(strSource1) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource1, j, 1)
Else: j = Int((Len(strSource) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource, j, 1)
End If
If KSec4 = "h1" Then j = Int((Len(strSource1) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource1, j, 1)
Else: j = Int((Len(strSource) - 1) * Rnd + 1)
strTarget = strTarget & Mid(strSource, j, 1)
End If
Next i
'*** when the Target String is complete, pass it back
KODGRUBUURET4 = strTarget
Exit_KODGRUBUURET4:
Exit Function
Err_KODGRUBUURET4:
MsgBox Err.Description
Resume Exit_KODGRUBUURET4