• DİKKAT

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

Hafta sonuna denk geliyor ise hafta başına at

Katılım
16 Mayıs 2020
Mesajlar
327
Excel Vers. ve Dili
Office 365 Türkçe
Girişler sayfasında E2:E ye kadar tarih girilecek ve tarih girince otomatik aynı tarihi F2:F sütununa atacak ama E2 ye girilen tarihler cumartesi veya pazara denk geliyorsa F2:F ye geçerken pazartesine atacak otomatik. Hafta içine denk geliyorsa değişmeyecek ama hafta sonuna denk geliyorsa direk pazartesi ye atacak mesala cumartesi ise pazartesiye atacak pazar ise yine pazartesiye atacak lütfen yardımlarınızı bekliyorum değişken adları ile yaparsansanız cok iyi olur
 
Sayfanızın kod bölümüne uygulayıp deneyiniz.

İlgili alana tarih girişi yaptığınızda işlem otomatik yapılacaktır.

C++:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Veri As Range
    
    If Intersect(Target, Range("E2:E" & Rows.Count)) Is Nothing Then Exit Sub
    
    For Each Veri In Intersect(Target, Range("E2:E" & Rows.Count))
        If IsDate(Veri.Value) Then
            Select Case Weekday(Veri.Value, vbMonday)
                Case 6: Veri.Offset(0, 1) = Veri.Value + 2
                Case 7: Veri.Offset(0, 1) = Veri.Value + 1
                Case Else: Veri.Offset(0, 1) = Veri.Value
            End Select
        ElseIf Veri.Value = "" Or Not IsNumeric(Veri.Value) Then
            Veri.Offset(0, 1).ClearContents
        End If
    Next
End Sub
 
Deneyiniz.
Kod:
Sub isgunu()
        
    Dim i As Long, a As Byte
    
    Application.ScreenUpdating = False
    Range("F2:F" & Rows.Count) = ""
    
    For i = 2 To Cells(Rows.Count, "E").End(xlUp).Row
        a = 0
        If Weekday(Cells(i, "E"), 2) > 5 Then a = Abs(Weekday(Cells(i, "E"), 2) - 8)
        Cells(i, "F") = Cells(i, "E") + a
    Next i

End Sub
 
Sayfanızın kod bölümüne uygulayıp deneyiniz.

İlgili alana tarih girişi yaptığınızda işlem otomatik yapılacaktır.

C++:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Veri As Range
   
    If Intersect(Target, Range("E2:E" & Rows.Count)) Is Nothing Then Exit Sub
   
    For Each Veri In Intersect(Target, Range("E2:E" & Rows.Count))
        If IsDate(Veri.Value) Then
            Select Case Weekday(Veri.Value, vbMonday)
                Case 6: Veri.Offset(0, 1) = Veri.Value + 2
                Case 7: Veri.Offset(0, 1) = Veri.Value + 1
                Case Else: Veri.Offset(0, 1) = Veri.Value
            End Select
        ElseIf Veri.Value = "" Or Not IsNumeric(Veri.Value) Then
            Veri.Offset(0, 1).ClearContents
        End If
    Next
End Sub
Çok sağolun çok makbule gecti inanın ? Korhan Bey
 
Deneyiniz.
Kod:
Sub isgunu()
       
    Dim i As Long, a As Byte
   
    Application.ScreenUpdating = False
    Range("F2:F" & Rows.Count) = ""
   
    For i = 2 To Cells(Rows.Count, "E").End(xlUp).Row
        a = 0
        If Weekday(Cells(i, "E"), 2) > 5 Then a = Abs(Weekday(Cells(i, "E"), 2) - 8)
        Cells(i, "F") = Cells(i, "E") + a
    Next i

End Sub
Ömer bey çok sağlun çok lazımdı ?
 
Merhaba,

Ömer Bey'in fonksiyonla verdiği kodun makro halini de seçenek olarak ben vereyim.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Intersect(Target, [E:E]) Is Nothing Or Target.Row < 2 Then Exit Sub
   
    If Not Target.Value = "" Then _
    Target.Offset(0, 1) = Evaluate("=WORKDAY(" & CDbl(Target.Value) & ",--(WEEKDAY(" & CDbl(Target.Value) & ",2)>5))")
   
End Sub
 
Merhaba,

Ömer Bey'in fonksiyonla verdiği kodun makro halini de seçenek olarak ben vereyim.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Intersect(Target, [E:E]) Is Nothing Or Target.Row < 2 Then Exit Sub
  
    If Not Target.Value = "" Then _
    Target.Offset(0, 1) = Evaluate("=WORKDAY(" & CDbl(Target.Value) & ",--(WEEKDAY(" & CDbl(Target.Value) & ",2)>5))")
  
End Sub
Teşekkürler Necdet Bey
 
Geri
Üst