wie kann ich eine Zufallszeichenkette aus zwei Zeichen
per Funktion erzeugen, die alle Buchstaben zwischen A - Z und 0 - 9
als Basis hat.
Infos Tips, waeren nett...
Bye
Nike
Public Function Zufall() As String
Dim strArray(1 To 36) As String
Dim intIndex As Integer, intCounter As Integer
Application.Volatile
Randomize Timer
For intIndex = 48 To 90
If intIndex = 58 Then intIndex = 65
intCounter = intCounter + 1
strArray(intCounter) = Chr(intIndex)
Next
Zufall = strArray(36 * rnd + 1) & strArray(36 * rnd + 1)
End Function
von Otto an Nike | ||
A | B | |
49 | Formel in Spalte A | |
50 | 13 | =ABRUNDEN(ZUFALLSZAHL()*(26+10);0) |
51 | 1 | =ABRUNDEN(ZUFALLSZAHL()*(26+10);0) |
52 | D1 | =WENN(A50<10;A50;ZEICHEN(A50+55)) & WENN(A51<10;A51;ZEICHEN(A51+55)) |
von Otto an Nike | |
A | |
2 | 0 |
3 | 1 |
4 | 2 |
5 | 3 |
6 | 4 |
7 | 5 |
8 | 6 |
9 | 7 |
10 | 8 |
11 | 9 |
12 | A |
13 | B |
14 | C |
15 | D |
16 | E |
17 | F |
18 | G |
19 | H |
20 | I |
21 | J |
22 | K |
23 | L |
24 | M |
25 | N |
26 | O |
27 | P |
28 | Q |
29 | R |
30 | S |
31 | T |
32 | U |
33 | V |
34 | W |
35 | X |
36 | Y |
37 | Z |
von Otto an Nike | ||
C | D | |
1 | Formel in Spalte C | |
2 | FE | =INDEX(Nike;ABRUNDEN(ZUFALLSZAHL()*(36);0);1) & INDEX(Nike;ABRUNDEN(ZUFALLSZAHL()*(36);0);1) |
Function Zufallswert() As String
Dim ZufallsZahl As Byte, i As Byte
Application.Volatile
For i = 1 To 2
ZufallsZahl = Int((36 * Rnd) + 1)
If ZufallsZahl > 26 Then
Zufallswert = Zufallswert & (ZufallsZahl - 27)
Else
Zufallswert = Zufallswert & Chr(ZufallsZahl + 64)
End If
Next i
End Function