• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

makro açıklaması

Katılım
20 Ekim 2005
Mesajlar
502
s.a.

aşağıdaki makronun açıklamısını yapan arkadaşlara şimdiden teşekkür ederim.

Sub Main()
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single

If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Cells.Clear
Application.ScreenUpdating = False
Counter = 1
RowMax = 100
ColMax = 25
For r = 1 To RowMax
For c = 1 To ColMax
Cells(r, c) = Int(Rnd * 1000)
Counter = Counter + 1
Next c
PctDone = Counter / (RowMax * ColMax)
With frmBekle
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With
DoEvents
Next r
Unload frmBekle
End Sub
 
Kod:
Sub Main()
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single

[COLOR=DarkGreen]'// Bana g&#246;re gereksiz bir sat&#305;r[/COLOR]
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub

[COLOR=DarkGreen]'// H&#252;creleri temizle(bi&#231;imleriyle)[/COLOR]
Cells.Clear

[COLOR=DarkGreen]'// Ekran g&#252;ncellemesini kapat[/COLOR]
Application.ScreenUpdating = False

Counter = 1
RowMax = 100
ColMax = 25

[COLOR=DarkGreen]'// D&#305;&#351; d&#246;ng&#252;y&#252; 100 kez tekrarla[/COLOR]
For r = 1 To RowMax

    [COLOR=DarkGreen]'// Her "r" i&#231;in 25 defa tekrarla[/COLOR]
    For c = 1 To ColMax
       [COLOR=DarkGreen] '// D&#246;ng&#252;lerin de&#287;erindeki h&#252;crelerde say&#305; &#252;ret (0-1000 aras&#305;)[/COLOR]
        Cells(r, c) = Int(Rnd * 1000)
        
        [COLOR=DarkGreen]'// Bu saya&#231; progress g&#246;stergesinde kullan&#305;l&#305;yor.[/COLOR]
        Counter = Counter + 1
    Next c
    
   [COLOR=DarkGreen] '// Progress i&#231;in oransal de&#287;er..[/COLOR]
    PctDone = Counter / (RowMax * ColMax)
    
    [COLOR=DarkGreen]'// Progress durumu i&#231;in nesnenin geni&#351;li&#287;ini ayarla[/COLOR]
    With frmBekle
        .FrameProgress.Caption = Format(PctDone, "0&#37;")
        .LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
    End With
    
    DoEvents
Next r

Unload frmBekle
End Sub
 
Geri
Üst