Excel Forum

Excel Forum (http://www.excel.web.tr/index.php)
-   Makro-VBA (http://www.excel.web.tr/forumdisplay.php?f=48)
-   -   rastgele sayı ve harf birlikte (http://www.excel.web.tr/showthread.php?t=114901)

askm 10-11-2017 09:21

Kod:

Sub SifreOlustur()
Dim a As Integer, c, b As String
Randomize Timer
c = "ABCDEFGHIJKLMNPQRSTUVWXYZ023456789"
For d = 1 To 3
    If d < 3 Then
        For l = 1 To 1
        b = b & "-"
            For k = 1 To 4
atla1:
                a = Fix(Rnd * 1000)
                If a < 32 Or a > 255 Then GoTo atla1
                If InStr(1, c, Chr(a)) > 0 Then b = b & Chr(a) Else GoTo atla1
            Next
        Next
Else
        For l = 1 To 1
        b = b & "-"
            For k = 1 To 6
atla2:
                a = Fix(Rnd * 1000)
                If a < 32 Or a > 255 Then GoTo atla2
                If InStr(1, c, Chr(a)) > 0 Then b = b & Chr(a) Else GoTo atla2
            Next
        Next
End If
Cells(l, 1) = Mid(b, 2, Len(b) - 1)
Next d
End Sub


mars2 10-11-2017 15:00

Sayın askm;

cevabınız için teşekkürler.

askm 10-11-2017 15:33

Rica ederim.


Saat 09:40

Powered by vBulletin Version 3.7.2
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.