• DİKKAT

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

İki Macro Kodu aynı sayfada çalıştırma

Katılım
14 Aralık 2011
Mesajlar
94
Excel Vers. ve Dili
Excel 2007
İki kodu aynı anda aynı sayfada nasıl çalıştırabilirim arkadaşlar

Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, [b:b]) Is Nothing Then Exit Sub

Cells(Target.Row, Target.Column + 1) = Date & " - " & Time

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [a:b]) Is Nothing Then Exit Sub
On Error GoTo son
If Target.Value = "" Then Exit Sub
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
son:
End Sub
 
Merhaba

Bu şekilde deneyiniz
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [a:b]) Is Nothing Then Exit Sub
On Error GoTo son

    If Intersect(Target, [b:b]) Then
    Cells(Target.Row, Target.Column + 1) = Date & " - " & Time
    End If
    
If Target.Value = "" Then Exit Sub
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
son:
End Sub
 
Başka bir altarnatif
Kod:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error GoTo son
    If Intersect(Target, [ a1:c65536]) Is Nothing Then Exit Sub
    Select Case Target.Column
        Case 1
            ActiveSheet.Unprotect
        Case 3
            Cells(Target.Row, Target.Column) = Date & " - " & Time
Target.Locked = True
ActiveSheet.Protect
End Select
son: Application.EnableEvents = True
End Sub
Not. Korhan Hocamın örneklerinden faydalanılarak düzenlenmiştir
 
Geri
Üst