DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Option Explicit
Sub Barkod_Olustur()
Dim X As Long, Son As Long, Barkod As Long, Liste As Variant
Dim Dizi As Object, Urun_Bul As Range, Adres As String
Application.ScreenUpdating = False
Set Dizi = CreateObject("Scripting.Dictionary")
Range("B2:B" & Rows.Count).ClearContents
Son = Cells(Rows.Count, 1).End(3).Row
Liste = Range("A2:A" & Son).Value
For X = LBound(Liste) To UBound(Liste)
If Cells(X, 2) = "" Then
10 Barkod = WorksheetFunction.RandBetween(10000, 99999)
If Not Dizi.Exists(Barkod) Then
Dizi.Add Barkod, Nothing
Cells(X, 2) = Barkod
Set Urun_Bul = Range("A:A").Find(Cells(X, 1), , , xlWhole)
If Not Urun_Bul Is Nothing Then
Adres = Urun_Bul.Address
Do
Urun_Bul.Offset(0, 1) = Barkod
Set Urun_Bul = Range("A:A").FindNext(Urun_Bul)
X = Urun_Bul.Row - 1
Loop While Not Urun_Bul Is Nothing And Adres <> Urun_Bul.Address
End If
Else
GoTo 10
End If
End If
Next
Set Urun_Bul = Nothing
Set Dizi = Nothing
Application.ScreenUpdating = True
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub