• DİKKAT

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

Tarihe gün ekle

Katılım
30 Kasım 2006
Mesajlar
411
Excel Vers. ve Dili
Excel 2007 - Türkçe
TextBox1 den girilen tarihe 30 gün eklenince çıkan gün Cumartesi ise 2 gün ekle,
Pazarsa 1 gün ekle hafta içi ise günü yaz
Textbox3 deki tarih herzaman hafta içi olsun


Private Sub CommandButton1_Click()

TextBox2 = Format(CDate(TextBox1.Text) + Day(30), "dd.mm.yyyy")

If TextBox2.Text = "Cumartesi" Then 'CUMARTESİ
TextBox3.Value = Format(CDate(TextBox2.Text) + Day(2), "dd.mm.yyyy")
Else
TextBox3.Value = TextBox1.Value
End If

If TextBox2.Text = "Pazar" Then ' PAZAR
TextBox3.Value = Format(CDate(TextBox2.Text) + Day(1), "dd.mm.yyyy")
Else
TextBox3.Value = TextBox1.Value
End If

End Sub
Private Sub UserForm_Initialize()
Me.TextBox1 = Format(Date, "dd.mm.yyyy")
End Sub
 

Ekli dosyalar

Son düzenleme:
Ömer bey kolay gelsin.:D
Kod:
If Weekday(CDate(TextBox1.Value) + 30, 2) = 6 Then
    TextBox3.Text = Format(CDate(TextBox1.Value) + 32, "dd.mm.yyyy")
    ElseIf Weekday(CDate(TextBox1.Value) + 30, 2) = 7 Then
    TextBox3.Text = Format(CDate(TextBox1.Value) + 31, "dd.mm.yyyy")
    Else
    TextBox3.Text = Format(CDate(TextBox1.Text) + 30, "dd.mm.yyyy")
End If
 
Teşekkürler hocam çok hızlısınız..

Şükranlarımı sunuyorum..
 
Geri
Üst