DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim S2 As Worksheet, BUL As Range, ADRES As String, X As Byte, VERİ() As String, YENİ_VERİ As String
On Error GoTo Son
Set S2 = Sheets("BÖLGELER")
S2.Range("AA4") = "BÖLGE"
S2.Range("AB4") = "İL"
S2.Range("AC4") = "İSİM"
If Intersect(Target, Range("B5:M" & Rows.Count)) Is Nothing Then Exit Sub
If Application.CutCopyMode = xlCopy Or Application.CutCopyMode = xlCut Then Exit Sub
Application.EnableEvents = False
If Target.Column = 2 Then
With Sheets("GELİR")
If UCase(Replace(Replace(Target, "ı", "I"), "i", "İ")) <> "TAKVİM" Then
.Columns("M:O").EntireColumn.Hidden = True
ElseIf UCase(Replace(Replace(Target, "ı", "I"), "i", "İ")) = "TAKVİM" Then
.Columns("M:O").EntireColumn.Hidden = False
End If
End With
ElseIf Target.Column = 2 Or Target.Column = 4 Or Target.Column = 5 Or Target.Column = 9 Or Target.Column = 10 Or Target.Column = 11 Then
Target = UCase(Replace(Replace(Target, "ı", "I"), "i", "İ"))
ElseIf Target.Column = 4 Then
S2.Range("AB5:AB" & Rows.Count).ClearContents
Set BUL = S2.Range("B:B").Find(Target, , , xlWhole)
If Not BUL Is Nothing Then
ADRES = BUL.Address
Do
If BUL.Offset(0, 1) <> "" Then
If WorksheetFunction.CountIf(S2.Range("AB:AB"), BUL.Offset(0, 1)) = 0 Then
S2.Cells(Rows.Count, "AB").End(3).Offset(1) = BUL.Offset(0, 1)
End If
End If
Set BUL = S2.Range("B:B").FindNext(BUL)
Loop While Not BUL Is Nothing And BUL.Address <> ADRES
End If
S2.Range("AB5:AB" & Rows.Count).Sort Key1:=S2.Range("AB5"), Order1:=xlAscending
S2.Cells.EntireColumn.AutoFit
If Target = "" Then
Application.EnableEvents = False
Range("E" & Target.Row & ":F" & Target.Row).ClearContents
Application.EnableEvents = True
End If
ElseIf Target.Column = 5 Then
S2.Range("AC5:AC" & Rows.Count).ClearContents
Set BUL = S2.Range("B:B").Find(Cells(Target.Row, "D"), , , xlWhole)
If Not BUL Is Nothing Then
ADRES = BUL.Address
Do
If BUL.Offset(0, 1) <> "" And Target = BUL.Offset(0, 1) Then
If WorksheetFunction.CountIf(S2.Range("AC:AC"), BUL.Offset(0, 2)) = 0 Then
S2.Cells(Rows.Count, "AC").End(3).Offset(1) = BUL.Offset(0, 2)
End If
End If
Set BUL = S2.Range("B:B").FindNext(BUL)
Loop While Not BUL Is Nothing And BUL.Address <> ADRES
End If
S2.Range("AC5:AC" & Rows.Count).Sort Key1:=S2.Range("AC5"), Order1:=xlAscending
S2.Cells.EntireColumn.AutoFit
ElseIf Target.Column = 6 Or Target.Column = 7 Then
Target = WorksheetFunction.Proper(Target)
VERİ = Split(Target, " ")
For X = LBound(VERİ) To UBound(VERİ) - 1
YENİ_VERİ = YENİ_VERİ & " " & VERİ(X)
Next
Target = YENİ_VERİ & " " & UCase(Replace(Replace(VERİ(UBound(VERİ)), "ı", "I"), "i", "İ"))
Target = Right(Target, Len(Target) - 1)
ElseIf Target.Column = 12 Or Target.Column = 13 Then
Cells(Target.Row, "N") = WorksheetFunction.Round(Cells(Target.Row, "M") * Cells(Target.Row, "L"), 2) / 100
Cells(Target.Row, "O") = WorksheetFunction.Round(Cells(Target.Row, "N") + Cells(Target.Row, "L"), 2)
End If
Son:
Application.EnableEvents = True
Set BUL = Nothing
Set S2 = Nothing
End Sub
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim X As Byte, VERİ() As String, YENİ_VERİ As String
On Error GoTo Son
If Intersect(Target, Range("B5:M" & Rows.Count)) Is Nothing Then Exit Sub
If Application.CutCopyMode = xlCopy Or Application.CutCopyMode = xlCut Then Exit Sub
Application.EnableEvents = False
If Target.Column = 2 Then
With Sheets("GELİR")
If UCase(Replace(Replace(Target, "ı", "I"), "i", "İ")) <> "TAKVİM" Then
.Columns("M:O").EntireColumn.Hidden = True
ElseIf UCase(Replace(Replace(Target, "ı", "I"), "i", "İ")) = "TAKVİM" Then
.Columns("M:O").EntireColumn.Hidden = False
End If
End With
ElseIf Target.Column = 2 Or Target.Column = 4 Or Target.Column = 5 Or Target.Column = 9 Or Target.Column = 10 Or Target.Column = 11 Then
Target = UCase(Replace(Replace(Target, "ı", "I"), "i", "İ"))
ElseIf Target.Column = 6 Or Target.Column = 7 Then
Target = WorksheetFunction.Proper(Target)
VERİ = Split(Target, " ")
For X = LBound(VERİ) To UBound(VERİ) - 1
YENİ_VERİ = YENİ_VERİ & " " & VERİ(X)
Next
Target = YENİ_VERİ & " " & UCase(Replace(Replace(VERİ(UBound(VERİ)), "ı", "I"), "i", "İ"))
Target = Right(Target, Len(Target) - 1)
ElseIf Target.Column = 12 Or Target.Column = 13 Then
Cells(Target.Row, "N") = WorksheetFunction.Round(Cells(Target.Row, "M") * Cells(Target.Row, "L"), 2) / 100
Cells(Target.Row, "O") = WorksheetFunction.Round(Cells(Target.Row, "N") + Cells(Target.Row, "L"), 2)
End If
Son:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim S1 As Worksheet, S2 As Worksheet, BUL As Range, ADRES As String
On Error GoTo Son
Set S1 = Sheets("ÜRÜNLER")
Set S2 = Sheets("BÖLGELER")
S1.Range("AA4") = "KASA"
S1.Range("AB4") = "GRUP"
S1.Range("AC4") = "ÜRÜN ADI"
S2.Range("AA4") = "BÖLGE"
S2.Range("AB4") = "İL"
S2.Range("AC4") = "İSİM"
If Target.Row < 5 Then Exit Sub
If Application.CutCopyMode = xlCopy Or Application.CutCopyMode = xlCut Then Exit Sub
Application.EnableEvents = False
S1.Range("B4:B" & S1.Cells(Rows.Count, 2).End(3).Row).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=S1.Range("AA4"), Unique:=True
S1.Range("AA5:AA" & Rows.Count).Sort Key1:=S1.Range("AA5"), Order1:=xlAscending
If Cells(Target.Row, "B") = "" Then S1.Range("AB5:AC" & Rows.Count).ClearContents
S2.Range("B4:B" & S[COLOR=red]2[/COLOR].Cells(Rows.Count, 2).End(3).Row).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=S2.Range("AA4"), Unique:=True
S2.Range("AA5:AA" & Rows.Count).Sort Key1:=S2.Range("AA5"), Order1:=xlAscending
If Cells(Target.Row, "D") = "" Then S2.Range("AB5:AC" & Rows.Count).ClearContents
If Target.Column = 9 And Cells(Target.Row, "B") <> "" Then
S1.Range("AB5:AB" & Rows.Count).ClearContents
Set BUL = S1.Range("B:B").Find(Cells(Target.Row, "B"), , , xlWhole)
If Not BUL Is Nothing Then
ADRES = BUL.Address
Do
If BUL.Offset(0, 1) <> "" Then
If WorksheetFunction.CountIf(S1.Range("AB:AB"), BUL.Offset(0, 1)) = 0 Then
S1.Cells(Rows.Count, "AB").End(3).Offset(1) = BUL.Offset(0, 1)
End If
End If
Set BUL = S1.Range("B:B").FindNext(BUL)
Loop While Not BUL Is Nothing And BUL.Address <> ADRES
End If
S1.Range("AB5:AB" & Rows.Count).Sort Key1:=S1.Range("AB5"), Order1:=xlAscending
S1.Cells.EntireColumn.AutoFit
ElseIf Target.Column = 10 And Cells(Target.Row, "B") <> "" Then
S1.Range("AC5:AC" & Rows.Count).ClearContents
Set BUL = S1.Range("B:B").Find(Cells(Target.Row, "B"), , , xlWhole)
If Not BUL Is Nothing Then
ADRES = BUL.Address
Do
If BUL.Offset(0, 1) <> "" And Cells(Target.Row, "I") = BUL.Offset(0, 1) Then
If WorksheetFunction.CountIf(S1.Range("AC:AC"), BUL.Offset(0, 2)) = 0 Then
S1.Cells(Rows.Count, "AC").End(3).Offset(1) = BUL.Offset(0, 2)
End If
End If
Set BUL = S1.Range("B:B").FindNext(BUL)
Loop While Not BUL Is Nothing And BUL.Address <> ADRES
End If
S1.Range("AC5:AC" & Rows.Count).Sort Key1:=S1.Range("AC5"), Order1:=xlAscending
S1.Cells.EntireColumn.AutoFit
ElseIf Target.Column = 5 And Cells(Target.Row, "D") <> "" Then
S2.Range("AB5:AB" & Rows.Count).ClearContents
Set BUL = S2.Range("B:B").Find(Cells(Target.Row, "D"), , , xlWhole)
If Not BUL Is Nothing Then
ADRES = BUL.Address
Do
If BUL.Offset(0, 1) <> "" Then
If WorksheetFunction.CountIf(S2.Range("AB:AB"), BUL.Offset(0, 1)) = 0 Then
S2.Cells(Rows.Count, "AB").End(3).Offset(1) = BUL.Offset(0, 1)
End If
End If
Set BUL = S2.Range("B:B").FindNext(BUL)
Loop While Not BUL Is Nothing And BUL.Address <> ADRES
End If
S2.Range("AB5:AB" & Rows.Count).Sort Key1:=S2.Range("AB5"), Order1:=xlAscending
S2.Cells.EntireColumn.AutoFit
ElseIf Target.Column = 6 And Cells(Target.Row, "D") <> "" Then
S2.Range("AC5:AC" & Rows.Count).ClearContents
Set BUL = S2.Range("B:B").Find(Cells(Target.Row, "D"), , , xlWhole)
If Not BUL Is Nothing Then
ADRES = BUL.Address
Do
If BUL.Offset(0, 1) <> "" And Cells(Target.Row, "E") = BUL.Offset(0, 1) Then
If WorksheetFunction.CountIf(S2.Range("AC:AC"), BUL.Offset(0, 2)) = 0 Then
S2.Cells(Rows.Count, "AC").End(3).Offset(1) = BUL.Offset(0, 2)
End If
End If
Set BUL = S2.Range("B:B").FindNext(BUL)
Loop While Not BUL Is Nothing And BUL.Address <> ADRES
End If
S2.Range("AC5:AC" & Rows.Count).Sort Key1:=S2.Range("AC5"), Order1:=xlAscending
S2.Cells.EntireColumn.AutoFit
End If
Son:
Application.EnableEvents = True
Set BUL = Nothing
Set S1 = Nothing
Set S2 = Nothing
End Sub