• DİKKAT

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

birden fazla if değeri, nasıl kullanılır.

Katılım
14 Ocak 2008
Mesajlar
176
Excel Vers. ve Dili
2010 türkçe
merhaba aşağıda yazdığım kodları çözümleyebilirmisiniz, if değeri ile tek sayfanın farklı bölümlerinde yazı yazdığımda, uyarı mesajları almak istiyorum, örneğin, I:Ag hücresi içinde işlem yaparsam, Ag hücresi 1 den büyükse uyarı versin. ancak bunun gibi birden fazla yapmam gerekenler var, bu formülleri birbirleriyle uyarlı nasıl yapabirilim.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Son
If Intersect(Target, [I:AG]) Is Nothing Then Exit Sub
If Cells(Target.Row, "AG") > Cells(Target.Row, "AH") Then MsgBox "Bu Şahsın Görev Sayısı 6 yı aşıyor : " & Cells(Target.Row, "Ag"), vbInformation
(ikinci if fonksiyonu)
If Intersect(Target, [I:L]) Is Nothing Then Exit Sub
If Cells(Target.Row, "AL") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
(üçüncü if fonksiyonu)
If Intersect(Target, [M:P]) Is Nothing Then Exit Sub
If Cells(Target.Row, "AJ") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
(dördüncü if fonksiyonu)
If Intersect(Target, [Q:T]) Is Nothing Then Exit Sub
If Cells(Target.Row, "AK") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
Son:
End Sub
 
Ekteki şekilde denermisiniz.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Son
If Intersect(Target, [I:AG]) Is Nothing Then goto git2
If Cells(Target.Row, "AG") > Cells(Target.Row, "AH") Then MsgBox "Bu Şahsın Görev Sayısı 6 yı aşıyor : " & Cells(Target.Row, "Ag"), vbInformation

'(ikinci if fonksiyonu)
git2:
If Intersect(Target, [I:L]) Is Nothing Then goto git3
If Cells(Target.Row, "AL") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation

'(üçüncü if fonksiyonu)
git3:
If Intersect(Target, [M:P]) Is Nothing Then goto git4
If Cells(Target.Row, "AJ") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
git4:
'(dördüncü if fonksiyonu)
If Intersect(Target, [Q:T]) Is Nothing Then Exit Sub
If Cells(Target.Row, "AK") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
Son:
End Sub
 
dosyayı gönderiyorum, yapabilirseniz çok sevinirim,
AG sütünu doğru ama, ikinci koşul da da uyarı mesajı almak istiyoruz, yani hem ag sütünü 5 ten büyük olursa, hem de Ocak, Şubat, Mart gibi aylar birden fazla işaretlenmişse, yardımınız için şimdiden çok teşekkür ederim.
 

Ekli dosyalar

ayrıca gönderdiğiniz kodu denedim, ikinci ve sonraki koşulları yapmadı,
AG sütünu doğru ama, ikinci koşul da da uyarı mesajı almak istiyoruz, yani hem ag sütünü 5 ten büyük olursa, hem de Ocak, Şubat, Mart gibi aylar birden fazla işaretlenmişse uyarı mesajı versin
 
dosyayı gönderiyorum, yapabilirseniz çok sevinirim,
AG sütünu doğru ama, ikinci koşul da da uyarı mesajı almak istiyoruz, yani hem ag sütünü 5 ten büyük olursa, hem de Ocak, Şubat, Mart gibi aylar birden fazla işaretlenmişse, yardımınız için şimdiden çok teşekkür ederim.

Kodları Aşağıdakilerle değiştirip test edermisiniz.
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Son
 
If Intersect(Target, [I:AG]) Is Nothing Then GoTo git2
If Cells(Target.Row, "AG") > Cells(Target.Row, "AH") Then MsgBox "Bu Şahsın Görev Sayısı 6 yı aşıyor : " & Cells(Target.Row, "Ag"), vbInformation

git2:

If Intersect(Target, [I:L]) Is Nothing Then GoTo git3
If WorksheetFunction.CountIf(Range(Cells(Target.Row, "I"), Cells(Target.Row, "L")), "*") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
git3:
If Intersect(Target, [M:P]) Is Nothing Then GoTo git4
If WorksheetFunction.CountIf(Range(Cells(Target.Row, "M"), Cells(Target.Row, "P")), "*") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
git4:
If Intersect(Target, [Q:T]) Is Nothing Then Exit Sub
If WorksheetFunction.CountIf(Range(Cells(Target.Row, "Q"), Cells(Target.Row, "T")), "*") > 1 Then MsgBox "Bir Aya İkiden Fazla Görev Verdiniz", vbInformation
Son:
End Sub
 
Geri
Üst