• DİKKAT

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

Kodları birleştir..!

Katılım
10 Ekim 2010
Mesajlar
1,469
Excel Vers. ve Dili
2010 Türkçe
Merhaba,
Aşağıda ki aynı başlıklı iki kodu nasıl birleştirebiliriz. Ben birleştiriyorum sürekli hata alıyorum.
Bu konuda hakkında birde forumdan yararlanmak istedim. Teşekkürler iyi akşamlar dilerim.










Private Sub Worksheet_Change(ByVal Target As Range)
Dim a As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
If Target.Count = 1 Then
If Intersect(Target, Range("A3:A" & Rows.Count)) Is Nothing Then Exit Sub
If Target <> Empty Then
Cells(Target.Row, "E") = 1
Else
Cells(Target.Row, "E") = Empty
End If
ElseIf Target.Count > 1 Then
For a = Target.Row To Target.Row + Target.Count
If Cells(a, "A") <> Empty Then
Cells(a, "E") = 1
Else
Cells(a, "E") = Empty
End If: Next: End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub


Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Son
If Intersect(Target, Range("B3:B" & Rows.Count)) Is Nothing Then Exit Sub
If Target = "" Then Exit Sub
Satır = Cells(Rows.Count, 1).End(3).Row
Cells(Target.Row, 1) = Cells(Satır, 1)
Cells(Target.Row, 3) = Cells(Satır, 3)
Son:
End Sub
 
Merhaba
Bu şekilde dener misiniz_?
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim a As Long
Application.EnableEvents = False
Application.ScreenUpdating = False
If Target.Column = 1 Then
If Target.Count = 1 Then
If Intersect(Target, Range("A3:A" & Rows.Count)) Is Nothing Then Exit Sub
If Target <> Empty Then
Cells(Target.Row, "E") = 1
Else
Cells(Target.Row, "E") = Empty
End If
ElseIf Target.Count > 1 Then
For a = Target.Row To Target.Row + Target.Count
If Cells(a, "A") <> Empty Then
Cells(a, "E") = 1
Else
Cells(a, "E") = Empty
End If: Next: End If
Application.ScreenUpdating = True
ElseIf Target.Column = 2 Then
On Error GoTo Son
If Intersect(Target, Range("B3:B" & Rows.Count)) Is Nothing Then Exit Sub
If Target = "" Then Exit Sub
Satır = Cells(Rows.Count, 1).End(3).Row
Cells(Target.Row, 1) = Cells(Satır, 1)
Cells(Target.Row, 3) = Cells(Satır, 3)
Son:
End If
Application.EnableEvents = True
End Sub
 
Merhaba
Mehmet Bey, teşekkür ederim. Elinize, bilginize sağlık. Şu normal bir şekilde çalışıyor…
İyi çalışmalar dilerim.
 
Geri
Üst