Назовите второй лист
table
и поместите туда таблицу, начиная с ячейки
(1, 1)
Public Function Encrypt(pass As String, login As String)
Dim PassLength As Integer
Dim r, c, z As Integer
Dim encrypt_str As String
Dim ps, ls As String
PassLength = 16
encrrypt_str = ""
For i = 0 To PassLength - 1
ps = Mid(pass, (i Mod Len(pass)) + 1, 1)
ls = Mid(login, (i Mod Len(login)) + 1, 1)
For j = 1 To 39
For k = 1 To 3
If (Worksheets("table").Cells(j, k) = ps) Then
r = j
c = k
Exit For
End If
Next k
Next j
For l = 4 To 39
If (Worksheets("table").Cells(r, l) = ls) Then
z = l
Exit For
End If
Next l
encrrypt_str = encrrypt_str & Worksheets("table").Cells(c, z)
Next i
Encrypt = encrrypt_str
End Function