• DİKKAT

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

Makro kodunu kısaltmak

Katılım
30 Ekim 2010
Mesajlar
108
Excel Vers. ve Dili
2007 Türkçe
Kod:
If STOK_KODU.Locked = False Then
Range("A" & ActiveCell.Row).ClearContents
STOK_KODU.Text = ""
End If
If MALZEME.Locked = False Then
Range("B" & ActiveCell.Row).ClearContents
MALZEME.Text = ""
End If
If RENK.Locked = False Then
Range("C" & ActiveCell.Row).ClearContents
RENK.Text = ""
End If

Yukarıdaki Kodu daha kısa nasıl yazabilirim. "J" ye kadar devam ediyor
 
Deneyiniz.

Kod:
Private Sub CommandButton1_Click()
    Nesneler = Array("STOK_KODU", "MALZEME", "RENK")
    Sütun = Array("A", "B", "C")
    
    For X = 0 To UBound(Nesneler)
        If Me.Controls(Nesneler(X)).Locked = False Then
            Cells(ActiveCell.Row, Sütun(X)).ClearContents
        End If
    Next
End Sub
 
Geri
Üst