• DİKKAT

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

veri listeleme

Katılım
17 Haziran 2008
Mesajlar
94
Excel Vers. ve Dili
orta seviyede excel 2003
Şöyle bişey yapmak istiyorum A2 hücresinde data validation ile seçim yaptığımda Sheet 2 de ki illere göre verileri getirebilriyorum forum yardımı ile teşekkür ederim ama şöyle bişey yapabilirmiyiz Toplam değeri sıfır olanları ya da değeri olmayanları listeye getirmesin sadece toplam sütunundaki olan değerleri getirsin.
şimdiden herkesin bayramını en içten dileklerimle kutluyorum teşekkür ederim.
 

Ekli dosyalar

Merhaba,

Aşağıdaki kodları ilgili sayfanın (S1) kod bölümüne kopyalayıp deneyiniz.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Intersect(Target, [A2]) Is Nothing Or Target.Value = "" Then Exit Sub
    
    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With
    
    Dim s2  As Worksheet, _
        Kol As Integer, _
        i   As Long, _
        j   As Long, _
        c   As Range
    Set s2 = Sheets("S2")
    
    Set c = s2.Range("1:1").Find(Target.Value, LookIn:=xlValues)
    If Not c Is Nothing Then
        Kol = c.Column
    Else
        MsgBox Target.Value & " ADLI MERKEZ BULUNAMADI"
        Exit Sub
    End If
    
    i = Cells(Rows.Count, "A").End(3).Row
    
    If i > 4 Then Range("A5:D" & i).ClearContents
    
    i = 4
    
    For j = 3 To s2.Cells(Rows.Count, "A").End(3).Row - 1
        If s2.Cells(j, Kol) > 0 Then
            i = i + 1
            Cells(i, "A") = s2.Cells(j, "A")
            Cells(i, "B") = s2.Cells(j, Kol)
            Cells(i, "C") = s2.Cells(j, Kol + 1)
            Cells(i, "D") = s2.Cells(j, Kol + 2)
        End If
    Next j
    
    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
    
    MsgBox i - 4 & " Adet Kayıt Aktarılmıştır....", vbInformation, "N. YEŞERTENER"
    
End Sub
 

Ekli dosyalar

çok teşekkür ederim ellerinize sağlık, buna birde büykükten küçüğe doğru sırlamayı ekleyebilirmiyz..
 
çok teşekkür ederim ellerinize sağlık, buna birde büykükten küçüğe doğru sırlamayı ekleyebilirmiyz..

Merhaba,

Kodları aşağıdaki kodlar ile değiştiriniz.

Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Intersect(Target, [A2]) Is Nothing Or Target.Value = "" Then Exit Sub
    
    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With
    
    Dim s2  As Worksheet, _
        Kol As Integer, _
        i   As Long, _
        j   As Long, _
        c   As Range
    Set s2 = Sheets("S2")
    
    Set c = s2.Range("1:1").Find(Target.Value, LookIn:=xlValues)
    If Not c Is Nothing Then
        Kol = c.Column
    Else
        MsgBox Target.Value & " ADLI MERKEZ BULUNAMADI"
        Exit Sub
    End If
    
    i = Cells(Rows.Count, "A").End(3).Row
    
    If i > 4 Then Range("A5:D" & i).ClearContents
    
    i = 4
    
    For j = 3 To s2.Cells(Rows.Count, "A").End(3).Row - 1
        If s2.Cells(j, Kol) > 0 Then
            i = i + 1
            Cells(i, "A") = s2.Cells(j, "A")
            Cells(i, "B") = s2.Cells(j, Kol)
            Cells(i, "C") = s2.Cells(j, Kol + 1)
            Cells(i, "D") = s2.Cells(j, Kol + 2)
        End If
    Next j
    
    'B sütununa göre büyükten küçüğe sıralar
    Range("A5:D" & i).Sort Key1:=[B1], order1:=xlDescending
    
    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
    
    MsgBox i - 4 & " Adet Kayıt Aktarılmıştır....", vbInformation, "N. YEŞERTENER"
    
End Sub
 
birşey daha rica ede bilrmiyim bu makroyu sektör seçimi için nasıl uygulayabiliriyim.
 
Geri
Üst